diff options
author | Scott González <scott.gonzalez@gmail.com> | 2013-03-08 10:23:25 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-03-08 10:23:25 -0500 |
commit | e0b2644d91ffb8b59f9cf6d8ac8b45f94af7dacd (patch) | |
tree | 796948406d2ef535f1fc762a81c420bed248f4ed /ui/jquery.ui.effect.js | |
parent | cdff72efed495d7a17c551578079619712758793 (diff) | |
download | jquery-ui-e0b2644d91ffb8b59f9cf6d8ac8b45f94af7dacd.tar.gz jquery-ui-e0b2644d91ffb8b59f9cf6d8ac8b45f94af7dacd.zip |
Removed guard against duplicate loading. Use safe references to original functions when proxying, don't rename originals.
Diffstat (limited to 'ui/jquery.ui.effect.js')
-rw-r--r-- | ui/jquery.ui.effect.js | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/ui/jquery.ui.effect.js b/ui/jquery.ui.effect.js index f3d9929b0..3d65b40c7 100644 --- a/ui/jquery.ui.effect.js +++ b/ui/jquery.ui.effect.js @@ -8,7 +8,7 @@ * * http://api.jqueryui.com/category/effects-core/ */ -;(jQuery.effects || (function($, undefined) { +(function($, undefined) { var dataSpace = "ui-effects-"; @@ -839,39 +839,42 @@ $.effects.animateClass = function( value, duration, easing, callback ) { }; $.fn.extend({ - _addClass: $.fn.addClass, - addClass: function( classNames, speed, easing, callback ) { - return speed ? - $.effects.animateClass.call( this, - { add: classNames }, speed, easing, callback ) : - this._addClass( classNames ); - }, - - _removeClass: $.fn.removeClass, - removeClass: function( classNames, speed, easing, callback ) { - return arguments.length > 1 ? - $.effects.animateClass.call( this, - { remove: classNames }, speed, easing, callback ) : - this._removeClass.apply( this, arguments ); - }, - - _toggleClass: $.fn.toggleClass, - toggleClass: function( classNames, force, speed, easing, callback ) { - if ( typeof force === "boolean" || force === undefined ) { - if ( !speed ) { - // without speed parameter - return this._toggleClass( classNames, force ); + addClass: (function( orig ) { + return function( classNames, speed, easing, callback ) { + return speed ? + $.effects.animateClass.call( this, + { add: classNames }, speed, easing, callback ) : + orig.apply( this, arguments ); + }; + })( $.fn.addClass ), + + removeClass: (function( orig ) { + return function( classNames, speed, easing, callback ) { + return arguments.length > 1 ? + $.effects.animateClass.call( this, + { remove: classNames }, speed, easing, callback ) : + orig.apply( this, arguments ); + }; + })( $.fn.removeClass ), + + toggleClass: (function( orig ) { + return function( classNames, force, speed, easing, callback ) { + if ( typeof force === "boolean" || force === undefined ) { + if ( !speed ) { + // without speed parameter + return orig.apply( this, arguments ); + } else { + return $.effects.animateClass.call( this, + (force ? { add: classNames } : { remove: classNames }), + speed, easing, callback ); + } } else { + // without force parameter return $.effects.animateClass.call( this, - (force ? { add: classNames } : { remove: classNames }), - speed, easing, callback ); + { toggle: classNames }, force, speed, easing ); } - } else { - // without force parameter - return $.effects.animateClass.call( this, - { toggle: classNames }, force, speed, easing ); - } - }, + }; + })( $.fn.toggleClass ), switchClass: function( remove, add, speed, easing, callback) { return $.effects.animateClass.call( this, { @@ -1283,4 +1286,4 @@ $.each( baseEasings, function( name, easeIn ) { })(); -})(jQuery)); +})(jQuery); |