Skip to content

Commit a9c2a9b

Browse files
mikesherovdmethvin
authored andcommitted
Scorch the earth and retreat on readyState interactive! Close jquerygh-907.
1 parent 10901f7 commit a9c2a9b

File tree

6 files changed

+13
-137
lines changed

6 files changed

+13
-137
lines changed

src/core.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -831,9 +831,9 @@ jQuery.ready.promise = function( obj ) {
831831
readyList = jQuery.Deferred();
832832

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

test/data/event/asyncReady.html

-30
This file was deleted.

test/data/event/longLoad.php

-6
This file was deleted.

test/data/event/partialLoadReady.php

-40
This file was deleted.

test/data/event/syncReadyLongLoad.html

-26
This file was deleted.

test/unit/event.js

+11-33
Original file line numberDiff line numberDiff line change
@@ -2882,39 +2882,17 @@ test("fixHooks extensions", function() {
28822882
jQuery.event.fixHooks.click = saved;
28832883
});
28842884

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

2886-
// async loaded tests expect jQuery to be loaded as a single file
2887-
// if we're not doing PHP concat, then we fall back to document.write
2888-
// which breaks order of execution on async loaded files
2889-
// also need PHP to make the incepted IFRAME hang
2890+
// need PHP here to make the incepted IFRAME hang
28902891
if ( hasPHP ) {
2891-
testIframeWithCallback( "jQuery.ready promise", "event/promiseReady.html", function( isOk ) {
2892-
expect(1);
2893-
ok( isOk, "$.when( $.ready ) works" );
2894-
});
2895-
28962892
testIframeWithCallback( "jQuery.ready synchronous load with long loading subresources", "event/syncReady.html", function( isOk ) {
28972893
expect(1);
28982894
ok( isOk, "jQuery loaded synchronously fires ready when the DOM can truly be interacted with" );
28992895
});
2900-
2901-
testIframeWithCallback( "jQuery.ready synchronous load with partially loaded page", "event/partialLoadReady.php", function( isOk ) {
2902-
expect(1);
2903-
ok( isOk, "jQuery loaded synchronously fires ready when the DOM can truly be interacted with" );
2904-
});
2905-
2906-
// allIE needs all subresources and full page to be loaded before it can gaurantee the document is truly ready to be interacted with
2907-
if( !document.attachEvent ) {
2908-
testIframeWithCallback( "jQuery.ready synchronous load with long loading iframe", "event/syncReadyLongLoad.html", function( isOk ) {
2909-
expect(1);
2910-
ok( isOk, "jQuery loaded synchronously fires ready before all sub-resources are loaded" );
2911-
});
2912-
2913-
testIframeWithCallback( "jQuery.ready asynchronous load with long loading iframe", "event/asyncReady.html", function( isOk ) {
2914-
expect(1);
2915-
ok( isOk, "jQuery loaded asynchronously fires ready before all sub-resources are loaded" );
2916-
});
2917-
}
29182896
}
29192897

29202898
(function(){
@@ -2994,22 +2972,22 @@ test("change handler should be detached from element", function() {
29942972
expect( 2 );
29952973

29962974
var $fixture = jQuery( "<input type='text' id='change-ie-leak' />" ).appendTo( "body" );
2997-
2975+
29982976
var originRemoveEvent = jQuery.removeEvent;
2999-
2977+
30002978
var wrapperRemoveEvent = function(elem, type, handle){
30012979
equal("change", type, "Event handler for 'change' event should be removed");
30022980
equal("change-ie-leak", jQuery(elem).attr("id"), "Event handler for 'change' event should be removed from appropriate element");
30032981
originRemoveEvent(elem, type, handle);
30042982
};
3005-
2983+
30062984
jQuery.removeEvent = wrapperRemoveEvent ;
3007-
2985+
30082986
$fixture.bind( "change", function( event ) {});
30092987
$fixture.unbind( "change" );
3010-
2988+
30112989
$fixture.remove();
3012-
2990+
30132991
jQuery.removeEvent = originRemoveEvent;
30142992
});
30152993

0 commit comments

Comments
 (0)