diff options
author | gnarf <gnarf@gnarf.net> | 2011-03-15 09:00:45 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-03-15 09:00:45 -0400 |
commit | d64c9efda53f6e56feacf5f39940cd7719a2cb61 (patch) | |
tree | fdcba508d910e24b946367d7d1a5195ceb2d7d62 /ui/jquery.effects.core.js | |
parent | 56b7ec134d8e1203f700f99dabcdad8c50a9b0c2 (diff) | |
download | jquery-ui-d64c9efda53f6e56feacf5f39940cd7719a2cb61.tar.gz jquery-ui-d64c9efda53f6e56feacf5f39940cd7719a2cb61.zip |
Effects: Moved effects to $.effects.effect[] and deprecated use of $.effects[]. Fixes #7103 - Effects: Move effects to $.effects.effect[].
Diffstat (limited to 'ui/jquery.effects.core.js')
-rw-r--r-- | ui/jquery.effects.core.js | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 0d326954a..573cb2554 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -9,7 +9,11 @@ */ ;jQuery.effects || (function($, undefined) { -$.effects = {}; +var backCompat = $.uiBackCompat !== false; + +$.effects = { + effect: {} +}; /******************************************************************************/ /****************************** COLOR ANIMATIONS ******************************/ @@ -493,7 +497,11 @@ function standardSpeed( speed ) { } // invalid strings - treat as "normal" speed - if ( typeof speed === "string" && !$.effects[ speed ] ) { + if ( typeof speed === "string" && !$.effects.effect[ speed ] ) { + // TODO: remove in 2.0 (#7115) + if ( backCompat && $.effects[ speed ] ) { + return false; + } return true; } @@ -504,9 +512,12 @@ $.fn.extend({ effect: function( effect, options, speed, callback ) { var args = _normalizeArguments.apply( this, arguments ), mode = args.mode, - effectMethod = $.effects[ args.effect ]; - - if ( $.fx.off || !effectMethod ) { + effectMethod = $.effects.effect[ args.effect ], + + // DEPRECATED: remove in 2.0 (#7115) + oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ]; + + if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) { // delegate to the original method (e.g., .show()) if possible if ( mode ) { return this[ mode ]( args.duration, args.complete ); @@ -518,7 +529,19 @@ $.fn.extend({ }); } } - return effectMethod.call( this, args ); + + // TODO: remove this check in 2.0, effectMethod will always be true + if ( effectMethod ) { + return effectMethod.call( this, args ); + } else { + // DEPRECATED: remove in 2.0 (#7115) + return oldEffectMethod.call(this, { + options: args, + duration: args.duration, + callback: args.complete, + mode: args.mode + }); + } }, _show: $.fn.show, |