Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#10737 closed bug (fixed)

IE7 / 8 - Fixed Position Test Issue

Reported by: hgblevins <[email protected]…> Owned by: hgblevins <[email protected]…>
Priority: high Milestone: None
Component: support Version: 1.7
Keywords: Cc:
Blocked by: Blocking:

Description

When asynchronously loading jQuery 1.7 via RequireJs 1.0.1 in IE7 / 8, fixed position tests at document ready (line 1602) fires, setting testElement to null (line 1653), before attempting to set innerHtml on testElement (line 1658). Script fails since testElement is null at the time of innerHTML assignment.

Issue is not present loading jQuery 1.7 synchronously via script element in head of document in IE7 / 8.

Issue is not present loading jQuery 1.7 asynchronously via RequireJs in the latest versions of Chrome, Firefox, Safari (Mac or PC).

Issue is not present loading jQuery 1.6.4 asynchronously via RequireJs in IE7 / 8 or latest versions of Chrome, Firefox, Safari (Mac or PC).

Change History (6)

comment:1 Changed 10 years ago by timmywil

Component: unfiledsupport
Owner: set to hgblevins <[email protected]…>
Priority: undecidedhigh
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:2 Changed 10 years ago by hgblevins <[email protected]…>

Status: pendingnew

This seems to be an extreme edge case that is impacted by the number of elements that can load external resources in the body of the document. For this ticket, the element is an iframe. In development, the iframe is loading facebook like buttons. In the test case I've provided, the iframe is loading jquery.com. Both produce the same result.

As the number of iframes in the body increases, the chance of the script error occurring also increases.

jsFiddle test case: http://jsfiddle.net/Z2dzz/

I'm hoping the jsFiddle is enough. In any event, I've provided two screenshots of a local running version of the test case.

Loading jQuery 1.7 Asynchronously: http://businessbullpen.com/images/jquery/10737/Asynchronous.png

Loading jQuery 1.7 Synchronously: http://businessbullpen.com/images/jquery/10737/Synchronous.png

comment:3 Changed 10 years ago by davidhong

EDIT: my post pretty much mirrors what the description states.

Without going into too much detail about async stuff, the issue seems to be that there is an inconsistent behaviour in order of execution:

https://github.com/jquery/jquery/blob/master/src/support.js#L314

I've had to wrap those two lines in a if statement to temporarily avoid this problem.

if (testElement !== null) {
  testElement.innerHTML = "";
  testElementParent.removeChild( testElement );
}

It appears that the code block above (which runs on jQuery onload) clears the testElement. Therefore triggering this error.

https://github.com/jquery/jquery/blob/master/src/support.js#L309

testElement = container = null;

Hope this helps.

Last edited 10 years ago by davidhong (previous) (diff)

comment:4 Changed 10 years ago by timmywil

Resolution: fixed
Status: newclosed

Move clearing the support vars to before the offset doc ready call in case the offset tests are run synchronously. Fixes #10737.

comment:5 Changed 10 years ago by timmywil

#10769 is a duplicate of this ticket.

comment:6 Changed 10 years ago by timmywil

#10790 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.