WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
Bug 55132
DOMContentLoaded event is fired too early if scripts are inserted dynamically
https://bugs.webkit.org/show_bug.cgi?id=55132
Summary
DOMContentLoaded event is fired too early if scripts are inserted dynamically
Wladimir Palant
Reported
2011-02-24 04:15:22 PST
Created
attachment 83631
[details]
Testcase It seems that WebKit's DOMContentLoaded event fails to consider dynamically inserted scripts properly. If a webpage inserts scripts dynamically during load Gecko and Opera will allow these scripts to run (they might still call document.write and such) and will only fire DOMContentLoaded event then. WebKit however ignores dynamically inserted scripts - DOMContentLoaded is fired immediately after the last "static" script finished executing. The attached testcase exemplifies this, it will check for two scripts whether they had a chance to run before DOMContentLoaded and "load" events. The expected result is that on DOMContentLoaded both scripts already executed - that's what I see in Firefox 3.6.13 and Opera 9.64. In Chrome 9.0.597.98 and Safari 4.0 however the dynamically inserted script didn't run on DOMContentLoaded, that is only the case when the "load" event is fired. I originally came across this issue on
http://www.zeit.de/politik/ausland/2011-02/libyen-gadhafi-proteste-staemme
. The map there works by inserting a bunch of scripts into the document. One of these scripts will run on DOMContentLoaded (via jQuery.ready()) and expects the other scripts to be loaded. However, this isn't always the case in Chrome, it is rather a race condition.
Attachments
Testcase
(695 bytes, text/html)
2011-02-24 04:15 PST
,
Wladimir Palant
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Ahmad Saleem
Comment 1
2024-09-20 20:56:23 PDT
*** Chrome Canary 131 *** DOMContentLoaded: Dynamic script loaded: false Static script loaded: true load: Dynamic script loaded: true Static script loaded: true *** Firefox Nightly 132 *** DOMContentLoaded: Dynamic script loaded: true Static script loaded: true load: Dynamic script loaded: true Static script loaded: true *** Safari Technology Preview 203 *** DOMContentLoaded: Dynamic script loaded: false Static script loaded: true load: Dynamic script loaded: true Static script loaded: true ___ Safari & Chrome are matching while Firefox is throwing `true` for dynamic script loaded. Just sharing up-to-date result.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug