Bug Tracker

Opened 11 years ago

Closed 10 years ago

Last modified 8 years ago

#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)

test-4320.html (541 bytes) - added by dmethvin 10 years ago.
Test case for #4320, moved from duplicate ticket #4632

Download all attachments as: .zip

Change History (13)

comment:1 Changed 11 years ago by 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.

comment:2 in reply to:  1 Changed 11 years ago by phloc_bg

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 10 years ago by dmethvin

need: ReviewTest Case

Also reported by several people in #4406; may be a Firefox bug? Still need a test case.

Changed 10 years ago by dmethvin

Attachment: test-4320.html added

Test case for #4320, moved from duplicate ticket #4632

comment:4 Changed 10 years ago by dmethvin

need: Test CasePatch

comment:5 Changed 10 years ago by dmethvin

Correction: attachment was from duplicate #4558

comment:6 Changed 10 years ago by dmethvin

More info in duplicate #5032.

comment:7 Changed 10 years ago by dmethvin

Resolution: duplicate
Status: newclosed

I think this is a dup of #5443, which has been fixed for 1.4. If not, reopen that ticket.

comment:8 Changed 10 years ago by john

Milestone: 1.3.21.4

Actually, a duplicate of #4406, I'll be moving over there.

comment:9 Changed 10 years ago by john

Component: supportevent
Resolution: duplicate
Status: closedreopened

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 10 years ago by john

Resolution: fixed
Status: reopenedclosed

comment:11 Changed 10 years ago by john

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 9 years ago by reesd

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.

Note: See TracTickets for help on using tickets.