#4320 closed bug (fixed)
document.body append-Error when using back-Button in IE7
Reported by: | Jonas Ulrich | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | event | Version: | 1.3.2 |
Keywords: | document.body append | Cc: | |
Blocked by: | Blocking: |
Description
It seems the feature-detection in jQuery 1.3.2 leads to an error when going back using the back-Button in IE7.
The error appears in line 3200:
jQuery(function(){ var div = document.createElement("div"); div.style.width = div.style.paddingLeft = "1px"; document.body.appendChild( div ); jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; document.body.removeChild( div ).style.display = 'none'; });
line 3200: "document.body.appendChild( div );"
Does jQuery wait for the onReady-Event when hitting the back-button?
Attachments (1)
Change History (13)
comment:1 follow-up: 2 Changed 14 years ago by
comment:2 Changed 14 years ago by
Replying to dmethvin:
Do you have a simple test case? It doesn't happen in IE for all uses of the back button so there must be some other issues involved.
Hi there, this is Boris. I expereienced this error in FF with heavy reloading (See also #4267) as well as in IE nearly everytime just normally loading the page. I think the only reason is that sometimes document.body is simply not yet loaded when the jquery script is included in the head. Perhaps this also depends how many other scripts are loaded after jquery in the head before the body can be initiated. But a null check would definitely be a good thing there!
comment:3 Changed 14 years ago by
need: | Review → Test Case |
---|
Also reported by several people in #4406; may be a Firefox bug? Still need a test case.
Changed 14 years ago by
Attachment: | test-4320.html added |
---|
comment:4 Changed 14 years ago by
need: | Test Case → Patch |
---|
comment:7 Changed 14 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
I think this is a dup of #5443, which has been fixed for 1.4. If not, reopen that ticket.
comment:8 Changed 14 years ago by
Milestone: | 1.3.2 → 1.4 |
---|
Actually, a duplicate of #4406, I'll be moving over there.
comment:9 Changed 14 years ago by
Component: | support → event |
---|---|
Resolution: | duplicate |
Status: | closed → reopened |
I take that back, this is the ticket with the good test case. I uploaded it here and can confirm the issue: http://ejohn.org/files/jquery/ticket/4320/
comment:10 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:11 Changed 14 years ago by
For the record, this is the test case showing that it's broken: http://ejohn.org/files/jquery/ticket/4320/
and this showing that it's working: http://ejohn.org/files/jquery/ticket/4320/fixed.html
Just watch the error console to see the results (or lack thereof).
comment:12 Changed 12 years ago by
I mentioned this in the github commit also, but thought I would capture it in the issue.
As sort of predicted by John, this breaks ready() for XUL. I don't see workaround for developers either other than not using ready (but plugins may depend on it). jquery-xul worked around this by changing the check to ( !document.body && ! document.activeElement). See https://github.com/ilyakharlamov/jquery-xul/blob/b556653a747cbf0ff22d520493288978892deb12/src/core.js.
Do you have a simple test case? It doesn't happen in IE for all uses of the back button so there must be some other issues involved.