From: Mike Sherov Date: Sun, 19 Aug 2012 21:41:43 +0000 (-0400) Subject: Fix #12282. IE has premature .readyState == "interactive". Close gh-901. X-Git-Tag: 1.8.1~36 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f553ed0ca0c50c5f66377e9f2c6314f822e8f25;p=jquery.git Fix #12282. IE has premature .readyState == "interactive". Close gh-901. --- diff --git a/src/core.js b/src/core.js index f9ee24852..4334ae261 100644 --- a/src/core.js +++ b/src/core.js @@ -830,9 +830,10 @@ jQuery.ready.promise = function( obj ) { readyList = jQuery.Deferred(); - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" || ( document.readyState !== "loading" && document.addEventListener ) ) { + // 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 + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready, 1 ); diff --git a/test/data/event/partialLoadReady.php b/test/data/event/partialLoadReady.php new file mode 100644 index 000000000..000ee567b --- /dev/null +++ b/test/data/event/partialLoadReady.php @@ -0,0 +1,40 @@ + + + + + + +Test case for jQuery ticket #12282 + + + +

TEST

+ + + + + +

Sleeping for 1 seconds (simulating server side process)

+ + + +
ready + + \ No newline at end of file diff --git a/test/data/testinit.js b/test/data/testinit.js index 18f9e2845..fbc858665 100644 --- a/test/data/testinit.js +++ b/test/data/testinit.js @@ -223,7 +223,7 @@ function url( value ) { }, 0 ); }; iframe = jQuery( "
" ).append( - jQuery( "