Skip to main content

Bug Tracker

Side navigation

#10737 closed bug (fixed)

Opened November 09, 2011 05:51PM UTC

Closed November 10, 2011 03:31PM UTC

Last modified November 16, 2011 02:10AM UTC

IE7 / 8 - Fixed Position Test Issue

Reported by: hgblevins <hgblevins@gmail.com> Owned by: hgblevins <hgblevins@gmail.com>
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).

Attachments (0)
Change History (6)

Changed November 09, 2011 06:52PM UTC by timmywil comment:1

component: unfiledsupport
owner: → hgblevins <hgblevins@gmail.com>
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.

Changed November 09, 2011 10:13PM UTC by hgblevins <hgblevins@gmail.com> comment:2

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:

[[Image(http://businessbullpen.com/images/jquery/10737/Asynchronous.png)]]

Loading jQuery 1.7 Synchronously:

[[Image(http://businessbullpen.com/images/jquery/10737/Synchronous.png)]]

Changed November 10, 2011 04:21AM UTC by davidhong comment:3

_comment0: 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.1320899539147128

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.

Changed November 10, 2011 03:31PM UTC by timmywil comment:4

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.

  • Adding a test for this would probably slow the manipulation tests significantly, but it's simple enough.

Changeset: d5897098510faba7f1c14fdd0ad961add42fb5c1

Changed November 12, 2011 05:54PM UTC by timmywil comment:5

#10769 is a duplicate of this ticket.

Changed November 16, 2011 02:10AM UTC by timmywil comment:6

#10790 is a duplicate of this ticket.