diff options
Diffstat (limited to 'src/core/ready.js')
-rw-r--r-- | src/core/ready.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/core/ready.js b/src/core/ready.js index 392c4849f..095e6daeb 100644 --- a/src/core/ready.js +++ b/src/core/ready.js @@ -82,7 +82,10 @@ function detach() { */ function completed() { // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { + if ( document.addEventListener || + event.type === "load" || + document.readyState === "complete" ) { + detach(); jQuery.ready(); } @@ -93,9 +96,12 @@ jQuery.ready.promise = function( obj ) { readyList = jQuery.Deferred(); - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // 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 + // Catch cases where $(document).ready() is called + // after the browser event has already occurred. + // 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.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready ); @@ -122,7 +128,7 @@ jQuery.ready.promise = function( obj ) { try { top = window.frameElement == null && document.documentElement; - } catch(e) {} + } catch ( e ) {} if ( top && top.doScroll ) { (function doScrollCheck() { @@ -132,7 +138,7 @@ jQuery.ready.promise = function( obj ) { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); - } catch(e) { + } catch ( e ) { return setTimeout( doScrollCheck, 50 ); } |