git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Only bind .ready() once per instance of jQuery - and only bind if the ready() method...
[jquery.git]
/
src
/
event
/
event.js
diff --git
a/src/event/event.js
b/src/event/event.js
index
2d00711
..
a4a99d9
100644
(file)
--- a/
src/event/event.js
+++ b/
src/event/event.js
@@
-529,6
+529,9
@@
jQuery.fn.extend({
* @see $(Function)
*/
ready: function(f) {
* @see $(Function)
*/
ready: function(f) {
+ // Attach the listeners
+ bindReady();
+
// If the DOM is already ready
if ( jQuery.isReady )
// Execute the function immediately
// If the DOM is already ready
if ( jQuery.isReady )
// Execute the function immediately
@@
-928,7
+931,13
@@
jQuery.extend({
};
});
};
});
-
+
+var readyBound = false;
+
+function bindReady(){
+ if ( readyBound ) return;
+ readyBound = true;
+
// If Mozilla is used
if ( jQuery.browser.mozilla || jQuery.browser.opera )
// Use the handy event callback
// If Mozilla is used
if ( jQuery.browser.mozilla || jQuery.browser.opera )
// Use the handy event callback
@@
-974,3
+983,4
@@
jQuery.extend({
// A fallback to window.onload, that will always work
jQuery.event.add( window, "load", jQuery.ready );
// A fallback to window.onload, that will always work
jQuery.event.add( window, "load", jQuery.ready );
+}