Side navigation
Ticket #5274: toggle_state_patch.diff
File toggle_state_patch.diff, 0.7 KB (added by mrspeaker, September 21, 2009 01:34AM UTC)
Store toggle state in data store using function guid
Index: event.js
===================================================================
--- event.js (revision 6582)
+++ event.js (working copy)
@@ -686,13 +686,14 @@
return this.click( jQuery.event.proxy( fn, function( event ) {
// Figure out which function to execute
- this.lastToggle = ( this.lastToggle || 0 ) % i;
+ var lastToggle = ( $(this).data( 'lastToggle' + fn.guid ) || 0 ) % i;
+ $(this).data( '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;
}));
},
Download in other formats:
Original Format
File toggle_state_patch.diff, 0.7 KB (added by mrspeaker, September 21, 2009 01:34AM UTC)
Store toggle state in data store using function guid
Index: event.js
===================================================================
--- event.js (revision 6582)
+++ event.js (working copy)
@@ -686,13 +686,14 @@
return this.click( jQuery.event.proxy( fn, function( event ) {
// Figure out which function to execute
- this.lastToggle = ( this.lastToggle || 0 ) % i;
+ var lastToggle = ( $(this).data( 'lastToggle' + fn.guid ) || 0 ) % i;
+ $(this).data( '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;
}));
},