aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2010-11-09 13:44:06 -0500
committerJohn Resig <jeresig@gmail.com>2010-11-09 13:44:06 -0500
commit983548f8ebc3fcd1bb4600bc4b740cb8a5d4c48b (patch)
tree85adceefe41c6ba7da7252bbd1a048dd9941156d /src
parentaa743969763bde258fd16979c7205605ac6eae0f (diff)
downloadjquery-983548f8ebc3fcd1bb4600bc4b740cb8a5d4c48b.tar.gz
jquery-983548f8ebc3fcd1bb4600bc4b740cb8a5d4c48b.zip
Make sure that if an additional load event is triggered (such as an iframe being dynamically injected in DOM ready) the ready event isn't triggered twice. Fixes #7352.
Diffstat (limited to 'src')
-rw-r--r--src/core.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/core.js b/src/core.js
index 8940ada2b..9e1bfc67f 100644
--- a/src/core.js
+++ b/src/core.js
@@ -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" );
+ }
}
}
},