Fix regression in add and append in IE after revision 3463
[jquery.git] / src / event.js
index 919dbf8..4775866 100644 (file)
@@ -429,21 +429,24 @@ function bindReady(){
                document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
        
        // If Safari or IE is used
-       else
+       else {
                // Continually check to see if the document is ready
-               (function timer() {
+               function timer(){
                        try {
-                               // If IE is used, use the excellent hack by Hedger Wang and Andrea Giammarchi
-                               // http://www.3site.eu/jstests/onContent/DOMReadyAnddoScroll.php
+                               // 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.firstChild.doScroll("left");
+                                       document.documentElement.doScroll("left");
        
                                // and execute any waiting functions
                                jQuery.ready();
                        } catch( error ) {
                                setTimeout( timer, 0 );
                        }
-               })();
+               }
+
+               timer();
+       }
 
        // A fallback to window.onload, that will always work
        jQuery.event.add( window, "load", jQuery.ready );