Skip to content

no ticket: scorch the earth and retreat on readyState interactive #907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,9 @@ jQuery.ready.promise = function( obj ) {
readyList = jQuery.Deferred();

// Catch cases where $(document).ready() is called after the browser event has already occurred.
// IE10 and lower don't handle "interactive" properly... use a weak inference to detect it
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading" ) {
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready, 1 );

Expand Down
30 changes: 0 additions & 30 deletions test/data/event/asyncReady.html

This file was deleted.

6 changes: 0 additions & 6 deletions test/data/event/longLoad.php

This file was deleted.

40 changes: 0 additions & 40 deletions test/data/event/partialLoadReady.php

This file was deleted.

26 changes: 0 additions & 26 deletions test/data/event/syncReadyLongLoad.html

This file was deleted.

44 changes: 11 additions & 33 deletions test/unit/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -2882,39 +2882,17 @@ test("fixHooks extensions", function() {
jQuery.event.fixHooks.click = saved;
});

testIframeWithCallback( "jQuery.ready promise", "event/promiseReady.html", function( isOk ) {
expect(1);
ok( isOk, "$.when( $.ready ) works" );
});

// async loaded tests expect jQuery to be loaded as a single file
// if we're not doing PHP concat, then we fall back to document.write
// which breaks order of execution on async loaded files
// also need PHP to make the incepted IFRAME hang
// need PHP here to make the incepted IFRAME hang
if ( hasPHP ) {
testIframeWithCallback( "jQuery.ready promise", "event/promiseReady.html", function( isOk ) {
expect(1);
ok( isOk, "$.when( $.ready ) works" );
});

testIframeWithCallback( "jQuery.ready synchronous load with long loading subresources", "event/syncReady.html", function( isOk ) {
expect(1);
ok( isOk, "jQuery loaded synchronously fires ready when the DOM can truly be interacted with" );
});

testIframeWithCallback( "jQuery.ready synchronous load with partially loaded page", "event/partialLoadReady.php", function( isOk ) {
expect(1);
ok( isOk, "jQuery loaded synchronously fires ready when the DOM can truly be interacted with" );
});

// allIE needs all subresources and full page to be loaded before it can gaurantee the document is truly ready to be interacted with
if( !document.attachEvent ) {
testIframeWithCallback( "jQuery.ready synchronous load with long loading iframe", "event/syncReadyLongLoad.html", function( isOk ) {
expect(1);
ok( isOk, "jQuery loaded synchronously fires ready before all sub-resources are loaded" );
});

testIframeWithCallback( "jQuery.ready asynchronous load with long loading iframe", "event/asyncReady.html", function( isOk ) {
expect(1);
ok( isOk, "jQuery loaded asynchronously fires ready before all sub-resources are loaded" );
});
}
}

(function(){
Expand Down Expand Up @@ -2994,22 +2972,22 @@ test("change handler should be detached from element", function() {
expect( 2 );

var $fixture = jQuery( "<input type='text' id='change-ie-leak' />" ).appendTo( "body" );

var originRemoveEvent = jQuery.removeEvent;

var wrapperRemoveEvent = function(elem, type, handle){
equal("change", type, "Event handler for 'change' event should be removed");
equal("change-ie-leak", jQuery(elem).attr("id"), "Event handler for 'change' event should be removed from appropriate element");
originRemoveEvent(elem, type, handle);
};

jQuery.removeEvent = wrapperRemoveEvent ;

$fixture.bind( "change", function( event ) {});
$fixture.unbind( "change" );

$fixture.remove();

jQuery.removeEvent = originRemoveEvent;
});

Expand Down