#10737 closed bug (fixed)
IE7 / 8 - Fixed Position Test Issue
Reported by: | Owned by: | ||
---|---|---|---|
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 11 years ago by
Component: | unfiled → support |
---|---|
Owner: | set to hgblevins <[email protected]…> |
Priority: | undecided → high |
Status: | new → pending |
comment:2 Changed 11 years ago by
Status: | pending → new |
---|
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.
comment:3 Changed 11 years ago by
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.
comment:4 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
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
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.