Skip to content

DOMContentLoaded handlers fail to fire after jQuery is loaded (Opera only) #2279

@jasonkarns

Description

@jasonkarns

There is some weird interplay between jQuery and standard DOMContentLoaded listener registration. This issue only manifests in Opera (only tested with 27.0.1689.76 on Mac). It does not appear to affect either stable or dev channels of: Safari, Chrome or Firefox.

jQuery itself doesn't need to be used at all, and in fact is not even used in the test case. Simply including jQuery in the page (at a specific point) causes the error. Removing jQuery fixes the issue.

Steps to reproduce:

  1. Add a standard DOMContentLoaded listener that:
    1. removes itself as event listener (https://gist.github.com/jasonkarns/f367c58149d9eda563bd#file-kill-domcontentloaded-js-L2)
    2. appends an iframe (https://gist.github.com/jasonkarns/f367c58149d9eda563bd#file-kill-domcontentloaded-js-L3)
  2. include jQuery (jquery must be loaded after the DOMContentLoaded listener per above)
  3. register any other DOMContentLoaded listeners. These listeners will never fire. These listeners can be registered before or after jQuery is loaded; it doesn't matter. As long as both jQuery and these listeners are loaded after the offending listener (no. 1 above) then they will fail to fire.

Minimal test case uses this gist for the offending DOMContentLoaded listener (step 1 above). Then includes jQuery. Then uses the JS pane to register an additional DOMContentLoaded listener, which never fires.

Minimal test case using jQuery 1.11.3 http://jsfiddle.net/1mmyx06b/11/
Minimal test case using jQuery 2.1.4 http://jsfiddle.net/1mmyx06b/10/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions