diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-09-20 10:07:45 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-09-20 10:07:45 -0400 |
commit | ce08df3bdc8f2806062f7a393975656f31cda035 (patch) | |
tree | 6833b0aba7429d53e11f92b8cbcf1f592bf22c5e /ui/jquery.effects.core.js | |
parent | a936eb3c0982293940a3f3135fc85178bf17534d (diff) | |
download | jquery-ui-ce08df3bdc8f2806062f7a393975656f31cda035.tar.gz jquery-ui-ce08df3bdc8f2806062f7a393975656f31cda035.zip |
Effects: Fixed .show(), .hide(), .toggle() to accept a hash of options again. Fixes #6078 - Effects: Passing an object for parameters no longer works. Fixes #6067 - Dialog show/hide animations do not work.
Diffstat (limited to 'ui/jquery.effects.core.js')
-rw-r--r-- | ui/jquery.effects.core.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 632e0e932..a835a062f 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -439,6 +439,20 @@ function _normalizeArguments(effect, options, speed, callback) { return [effect, options, speed, callback]; } +function standardSpeed( speed ) { + // valid standard speeds + if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { + return true; + } + + // invalid strings - treat as "normal" speed + if ( typeof speed === "string" && !$.effects[ speed ] ) { + return true; + } + + return false; +} + $.fn.extend({ effect: function(effect, options, speed, callback) { var args = _normalizeArguments.apply(this, arguments), @@ -455,7 +469,7 @@ $.fn.extend({ _show: $.fn.show, show: function(speed) { - if (!speed || typeof speed == 'number' || $.fx.speeds[speed] || !$.effects[speed] ) { + if ( standardSpeed( speed ) ) { return this._show.apply(this, arguments); } else { var args = _normalizeArguments.apply(this, arguments); @@ -466,7 +480,7 @@ $.fn.extend({ _hide: $.fn.hide, hide: function(speed) { - if (!speed || typeof speed == 'number' || $.fx.speeds[speed] || !$.effects[speed] ) { + if ( standardSpeed( speed ) ) { return this._hide.apply(this, arguments); } else { var args = _normalizeArguments.apply(this, arguments); @@ -478,8 +492,7 @@ $.fn.extend({ // jQuery core overloads toggle and creates _toggle __toggle: $.fn.toggle, toggle: function(speed) { - if (!speed || typeof speed == 'number' || $.fx.speeds[speed] || !$.effects[speed] || - typeof speed == 'boolean' || $.isFunction(speed)) { + if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { return this.__toggle.apply(this, arguments); } else { var args = _normalizeArguments.apply(this, arguments); |