diff options
Diffstat (limited to 'src/attributes/classes.js')
-rw-r--r-- | src/attributes/classes.js | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/attributes/classes.js b/src/attributes/classes.js index 1d24a1851..15a37bc99 100644 --- a/src/attributes/classes.js +++ b/src/attributes/classes.js @@ -100,10 +100,7 @@ jQuery.fn.extend( { toggleClass: function( value, stateVal ) { var type = typeof value, - classNames = type === "string" ? value.match( rnotwhite ) : "", - checker = typeof stateVal === "boolean" ? - function() { return !stateVal; } : - jQuery.fn.hasClass; + classNames = type === "string" ? value.match( rnotwhite ) : []; return this.each( function( i ) { var className, @@ -118,7 +115,7 @@ jQuery.fn.extend( { // Toggle individual class names based on presence or stateVal while ( ( className = classNames[ c++ ] ) ) { - if ( checker.call( self, className ) ) { + if ( stateVal === false || stateVal !== true && self.hasClass( className ) ) { self.removeClass( className ); } else { self.addClass( className ); |