mirror of
https://github.com/jquery/jquery.git
synced 2026-02-07 09:34:59 -05:00
Deprecate fn toggle Closes gh-970 https://github.com/jquery/2012-dev-summit/issues/24
This commit is contained in:
committed by
Rick Waldron
parent
d6c84c5bb5
commit
9104a3d5f2
26
src/event.js
26
src/event.js
@@ -980,32 +980,6 @@ jQuery.fn.extend({
|
||||
}
|
||||
},
|
||||
|
||||
toggle: function( fn ) {
|
||||
// Save reference to arguments for access in closure
|
||||
var args = arguments,
|
||||
guid = fn.guid || jQuery.guid++,
|
||||
i = 0,
|
||||
toggler = function( event ) {
|
||||
// Figure out which function to execute
|
||||
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[ lastToggle ].apply( this, arguments ) || false;
|
||||
};
|
||||
|
||||
// link all the functions, so any of them can unbind this click handler
|
||||
toggler.guid = guid;
|
||||
while ( i < args.length ) {
|
||||
args[ i++ ].guid = guid;
|
||||
}
|
||||
|
||||
return this.click( toggler );
|
||||
},
|
||||
|
||||
hover: function( fnOver, fnOut ) {
|
||||
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user