]> source.dussan.org Git - jquery.git/commitdiff
reduce complexity of ready further, and try manipulating DOM to make sure we're reall... 763/head
authorMike Sherov <mike.sherov@gmail.com>
Fri, 4 May 2012 17:31:35 +0000 (13:31 -0400)
committerMike Sherov <mike.sherov@gmail.com>
Fri, 4 May 2012 17:31:35 +0000 (13:31 -0400)
src/core.js
test/data/event/asyncReady.html
test/data/event/syncReady.html

index b5b8efcd7ab3c24e5ad4aa95cc9786ce244a1b0b..6746802e694dea744d4ae86ca2b716b9d2fc5a6a 100644 (file)
@@ -59,18 +59,16 @@ var jQuery = function( selector, context ) {
        // The deferred used on DOM ready
        readyList,
 
-       // The ready event handler
-       // Cleanup function for the document ready method
+       // The ready event handler and self cleanup method
        DOMContentLoaded = function() {
                if ( document.addEventListener ) {
                        document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-                       jQuery.ready();
-               } else if ( document.readyState !== "loading" ) {
-                       // if document.addEventListener isn't present, we assume detachEvent is!
-                       // Make sure body exists by checking readystate, at least, in case IE gets a little overzealous (ticket #5443).
+               } else {
+                       // we're here because readyState !== "loading" in oldIE
+                       // which is good enough for us to call the dom ready!
                        document.detachEvent( "onreadystatechange", DOMContentLoaded );
-                       jQuery.ready();
                }
+               jQuery.ready();
        },
 
        // Save a reference to some core methods
index e32ff9cfb4b6e7f280a67b478c8c331ea05b7948..0b389d854e424933885adee2721e60ffc24dd922 100644 (file)
@@ -14,6 +14,7 @@ if ( document.attachEvent ) {
                el.type = "text/javascript";
                el.onload = function() {
                        jQuery( document ).ready(function() {
+                               jQuery("body").append("<div>modifying DOM</div>");
                                window.parent.iframeCallback( true );
                        });
            }
index df66bc623b60a7b2d341c18e4ef1c2349b5a06ce..1b85ce0a8928b0897807620c2fca2e32f2134616 100644 (file)
@@ -8,6 +8,7 @@
 <body>
 <script type="text/javascript">
 jQuery( document ).ready(function () {
+       jQuery("body").append("<div>modifying DOM</div>");
        window.parent.iframeCallback( true );
 });
 </script>