diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2012-07-06 10:12:20 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-07-06 10:12:20 -0400 |
commit | f5fd41252e3ae48a655c5da4a0b2910bb897b6ed (patch) | |
tree | 2128bb89a2e85ca05e79cdaf8772df5f3e20b7e7 /src/core.js | |
parent | aaf134bb7092efe7b450fc08ca5cc3c53cb00d76 (diff) | |
download | jquery-f5fd41252e3ae48a655c5da4a0b2910bb897b6ed.tar.gz jquery-f5fd41252e3ae48a655c5da4a0b2910bb897b6ed.zip |
Fix #12018, readyState "interactive" in oldIE lies! Closes gh-848.
Diffstat (limited to 'src/core.js')
-rw-r--r-- | src/core.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core.js b/src/core.js index c92774075..6b0615009 100644 --- a/src/core.js +++ b/src/core.js @@ -63,12 +63,13 @@ var DOMContentLoaded = function() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - } else { - // we're here because readyState !== "loading" in oldIE + jQuery.ready(); + } else if ( document.readyState === "complete" ) { + // we're here because readyState === "complete" in oldIE // which is good enough for us to call the dom ready! document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); } - jQuery.ready(); }, // [[Class]] -> type pairs @@ -818,7 +819,7 @@ jQuery.ready.promise = function( obj ) { // Catch cases where $(document).ready() is called after the // browser event has already occurred. - if ( document.readyState !== "loading" ) { + if ( document.readyState === "complete" || ( document.readyState !== "loading" && document.addEventListener ) ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready, 1 ); |