]> source.dussan.org Git - jquery.git/commitdiff
From a suggestion by Diego, moved the jQuery.ready() call outside of the try{}catch...
authorJohn Resig <jeresig@gmail.com>
Mon, 15 Oct 2007 17:55:54 +0000 (17:55 +0000)
committerJohn Resig <jeresig@gmail.com>
Mon, 15 Oct 2007 17:55:54 +0000 (17:55 +0000)
src/event.js

index 070ed9eb38a4b326771687bd039c42a6f6f42cbc..627f4d2a6c838066768cd1a9bc4df885fc91f283 100644 (file)
@@ -430,24 +430,20 @@ function bindReady(){
                document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
        
        // If Safari or IE is used
-       else {
-               // Continually check to see if the document is ready
-               function timer(){
-                       try {
-                               // If IE is used, use the trick by Diego Perini
-                               // http://javascript.nwbox.com/IEContentLoaded/
-                               if ( jQuery.browser.msie || document.readyState != "loaded" && document.readyState != "complete" )
-                                       document.documentElement.doScroll("left");
-       
-                               // and execute any waiting functions
-                               jQuery.ready();
-                       } catch( error ) {
-                               setTimeout( timer, 0 );
-                       }
+       // Continually check to see if the document is ready
+       else (function(){
+               try {
+                       // If IE is used, use the trick by Diego Perini
+                       // http://javascript.nwbox.com/IEContentLoaded/
+                       if ( jQuery.browser.msie || document.readyState != "loaded" && document.readyState != "complete" )
+                               document.documentElement.doScroll("left");
+               } catch( error ) {
+                       return setTimeout( arguments.callee, 0 );
                }
 
-               timer();
-       }
+               // and execute any waiting functions
+               jQuery.ready();
+       })();
 
        // A fallback to window.onload, that will always work
        jQuery.event.add( window, "load", jQuery.ready );