aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.js
diff options
context:
space:
mode:
authorMr Speaker <mrspeaker@gmail.com>2009-11-11 09:46:24 -0500
committerJohn Resig <jeresig@gmail.com>2009-11-11 09:46:24 -0500
commit5cb1163469fb2c9cd80712cd5481b29055821022 (patch)
tree5cd6531ea6e05537ce79b3c8afb58ac4227841ea /src/event.js
parent4b55e94d0849568a2fd121952f13a9d6571c731f (diff)
downloadjquery-5cb1163469fb2c9cd80712cd5481b29055821022.tar.gz
jquery-5cb1163469fb2c9cd80712cd5481b29055821022.zip
Making sure that you can bind multiple toggles to a single element without problems. Thanks to 'Mr Speaker' for the original patch. Fixes #5274.
Diffstat (limited to 'src/event.js')
-rw-r--r--src/event.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/event.js b/src/event.js
index 7cfb535b6..e2087cc13 100644
--- a/src/event.js
+++ b/src/event.js
@@ -693,13 +693,14 @@ jQuery.fn.extend({
return this.click( jQuery.event.proxy( fn, function( event ) {
// Figure out which function to execute
- this.lastToggle = ( this.lastToggle || 0 ) % i;
+ var lastToggle = ( jQuery.data( this, 'lastToggle' + fn.guid ) || 0 ) % i;
+ jQuery.data( this, 'lastToggle' + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
- return args[ this.lastToggle++ ].apply( this, arguments ) || false;
+ return args[ lastToggle ].apply( this, arguments ) || false;
}));
},