Side navigation
#4320 closed bug (fixed)
Opened March 10, 2009 11:10AM UTC
Closed November 09, 2009 12:50PM UTC
Last modified March 14, 2012 02:06PM UTC
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 (12)
Changed March 14, 2009 01:50AM UTC by comment:1
Changed March 19, 2009 05:20PM UTC by comment:2
Replying to [comment:1 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!
Changed October 19, 2009 01:51AM UTC by comment:3
need: | Review → Test Case |
---|
Also reported by several people in #4406; may be a Firefox bug? Still need a test case.
Changed October 19, 2009 01:56AM UTC by comment:4
need: | Test Case → Patch |
---|
Changed November 08, 2009 03:30PM UTC by comment:7
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.
Changed November 09, 2009 12:31PM UTC by comment:8
milestone: | 1.3.2 → 1.4 |
---|
Actually, a duplicate of #4406, I'll be moving over there.
Changed November 09, 2009 12:41PM UTC by comment:9
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:
Changed November 09, 2009 12:50PM UTC by comment:10
resolution: | → fixed |
---|---|
status: | reopened → closed |
Changed November 09, 2009 12:52PM UTC by comment:11
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).
Changed May 26, 2011 01:59AM UTC by comment:12
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.