Bug Tracker

Modify

Ticket #10737 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

IE7 / 8 - Fixed Position Test Issue

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

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

comment:1 Changed 2 years ago by timmywil

  • Owner set to hgblevins <hgblevins@…>
  • Priority changed from undecided to high
  • Status changed from new to pending
  • Component changed from unfiled to support

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 2 years ago by hgblevins <hgblevins@…>

  • Status changed from pending to 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.

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 2 years ago by davidhong

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.

Version 0, edited 2 years ago by davidhong (next)

comment:4 Changed 2 years ago by timmywil

  • Status changed from new to closed
  • Resolution set to fixed

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 2 years ago by timmywil

#10769 is a duplicate of this ticket.

comment:6 Changed 2 years ago by timmywil

#10790 is a duplicate of this ticket.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.