Effects: Cleanup.

This commit is contained in:
Scott González 2012-08-27 17:23:30 -04:00
parent 93556a8e18
commit 96cabd59ab

View File

@ -831,37 +831,42 @@ $.fn.extend({
_addClass: $.fn.addClass, _addClass: $.fn.addClass,
addClass: function( classNames, speed, easing, callback ) { addClass: function( classNames, speed, easing, callback ) {
return speed ? return speed ?
$.effects.animateClass.apply( this, [{ add: classNames }, speed, easing, callback ]) : $.effects.animateClass.call( this,
this._addClass(classNames); { add: classNames }, speed, easing, callback ) :
this._addClass( classNames );
}, },
_removeClass: $.fn.removeClass, _removeClass: $.fn.removeClass,
removeClass: function( classNames, speed, easing, callback ) { removeClass: function( classNames, speed, easing, callback ) {
return speed ? return speed ?
$.effects.animateClass.apply( this, [{ remove: classNames }, speed, easing, callback ]) : $.effects.animateClass.call( this,
this._removeClass(classNames); { remove: classNames }, speed, easing, callback ) :
this._removeClass( classNames );
}, },
_toggleClass: $.fn.toggleClass, _toggleClass: $.fn.toggleClass,
toggleClass: function( classNames, force, speed, easing, callback ) { toggleClass: function( classNames, force, speed, easing, callback ) {
if ( typeof force === "boolean" || force === undefined ) { if ( typeof force === "boolean" || force === undefined ) {
if ( !speed ) { if ( !speed ) {
// without speed parameter; // without speed parameter
return this._toggleClass( classNames, force ); return this._toggleClass( classNames, force );
} else { } else {
return $.effects.animateClass.apply( this, [( force ? { add:classNames } : { remove:classNames }), speed, easing, callback ]); return $.effects.animateClass.call( this,
(force ? { add: classNames } : { remove: classNames }),
speed, easing, callback );
} }
} else { } else {
// without force parameter; // without force parameter
return $.effects.animateClass.apply( this, [{ toggle: classNames }, force, speed, easing ]); return $.effects.animateClass.call( this,
{ toggle: classNames }, force, speed, easing );
} }
}, },
switchClass: function( remove, add, speed, easing, callback) { switchClass: function( remove, add, speed, easing, callback) {
return $.effects.animateClass.apply( this, [{ return $.effects.animateClass.call( this, {
add: add, add: add,
remove: remove remove: remove
}, speed, easing, callback ]); }, speed, easing, callback );
} }
}); });