Make sure that if an additional load event is triggered (such as an iframe being...
authorJohn Resig <jeresig@gmail.com>
Tue, 9 Nov 2010 18:44:06 +0000 (13:44 -0500)
committerJohn Resig <jeresig@gmail.com>
Tue, 9 Nov 2010 18:44:06 +0000 (13:44 -0500)
src/core.js

index 8940ada..9e1bfc6 100644 (file)
@@ -417,18 +417,21 @@ jQuery.extend({
                        // If there are functions bound, to execute
                        if ( readyList ) {
                                // Execute all of them
-                               var fn, i = 0;
-                               while ( (fn = readyList[ i++ ]) ) {
-                                       fn.call( document, jQuery );
-                               }
+                               var fn,
+                                       i = 0,
+                                       ready = readyList;
 
                                // Reset the list of functions
                                readyList = null;
-                       }
 
-                       // Trigger any bound ready events
-                       if ( jQuery.fn.trigger ) {
-                               jQuery( document ).trigger( "ready" ).unbind( "ready" );
+                               while ( (fn = ready[ i++ ]) ) {
+                                       fn.call( document, jQuery );
+                               }
+
+                               // Trigger any bound ready events
+                               if ( jQuery.fn.trigger ) {
+                                       jQuery( document ).trigger( "ready" ).unbind( "ready" );
+                               }
                        }
                }
        },