mirror of
https://github.com/jquery/jquery.git
synced 2026-02-07 15:15:07 -05:00
jquery core: Closes #1681. jQuery.fn.toggleClass can accept a boolean argument indicating add/remove.
This commit is contained in:
@@ -1284,8 +1284,10 @@ jQuery.each({
|
||||
jQuery.className.remove( this, classNames );
|
||||
},
|
||||
|
||||
toggleClass: function( classNames ) {
|
||||
jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
|
||||
toggleClass: function( classNames, state ) {
|
||||
if( typeof state !== "boolean" )
|
||||
state = !jQuery.className.has( this, classNames );
|
||||
jQuery.className[ state ? "add" : "remove" ]( this, classNames );
|
||||
},
|
||||
|
||||
remove: function( selector ) {
|
||||
|
||||
Reference in New Issue
Block a user