-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Description
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:
- Add a standard
DOMContentLoadedlistener that:- removes itself as event listener (https://gist.github.com/jasonkarns/f367c58149d9eda563bd#file-kill-domcontentloaded-js-L2)
- appends an iframe (https://gist.github.com/jasonkarns/f367c58149d9eda563bd#file-kill-domcontentloaded-js-L3)
- include jQuery (jquery must be loaded after the
DOMContentLoadedlistener per above) - register any other
DOMContentLoadedlisteners. 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/