#1251 closed bug (worksforme)
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 (6)
Changed 16 years ago by
Attachment: | jquery-defer.html added |
---|
comment:1 Changed 16 years ago by
Milestone: | 1.1.3 → 1.1.4 |
---|---|
Version: | 1.1.2 → 1.1.3 |
comment:3 Changed 16 years ago by
Owner: | set to john |
---|
comment:4 Changed 16 years ago by
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.
@geary: Is this still an issue? We resolved some IE loading issues in 1.1.3.1.