Side navigation
#1251 closed bug (worksforme)
Opened May 29, 2007 07:22AM UTC
Closed July 20, 2007 04:53PM UTC
Last modified July 20, 2007 08:43PM UTC
Setting .innerHTML while document loading breaks $(document).ready() in IE
Reported by: | geary | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.1.4 |
Component: | core | Version: | 1.1.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If JavaScript code sets the innerHTML of any element while the document is loading, $(document).ready() fires prematurely in IE. I believe the .innerHTML assignment causes IE to ignore the "defer" attribute in the special script tag used in $(document).ready().
To test, load this page (HTML also attached to the ticket):
http://mg.to/test/jquery-defer.html
If you don't get an error, reload the page several times and the error will occur soon enough. In a larger test case, the error happens every time.
In Firefox, the page loads without error, and the text "One!" is set to red by jQuery code running under $(document).ready().
In IE7, the page sometimes loads OK, but sometimes hits an error on line 9: "0.style is not null or not an object".
Of course, JavaScript code should not be setting .innerHTML while the page loads. However, many sites have code loaded from advertising networks that does bad things like this, and it is not always possible to prevent that code from running.
Attachments (1)
Change History (5)
Changed July 15, 2007 03:31PM UTC by comment:1
milestone: | 1.1.3 → 1.1.4 |
---|---|
version: | 1.1.2 → 1.1.3 |
Changed July 19, 2007 04:51PM UTC by comment:2
this is still an issue in 1.1.3.1.
Changed July 20, 2007 03:13PM UTC by comment:3
owner: | → john |
---|
Changed July 20, 2007 04:53PM UTC by comment:4
resolution: | → worksforme |
---|---|
status: | new → closed |
I, honestly, can't get this to duplicate, so I think this has been resolved. Please let me know if that is not the case.
My test:
@geary: Is this still an issue? We resolved some IE loading issues in 1.1.3.1.