aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorgnarf <gnarf@gnarf.net>2011-03-02 20:58:10 -0600
committergnarf <gnarf@gnarf.net>2011-03-02 20:58:10 -0600
commit5c4577f78c4db350ebcae1e96698721c0400fb7f (patch)
tree8fb04800eebb511fe535723600034cdcb90f2b43 /ui
parenta1c8c7bcd62bf829a5717d275fc35454624430b9 (diff)
downloadjquery-ui-5c4577f78c4db350ebcae1e96698721c0400fb7f.tar.gz
jquery-ui-5c4577f78c4db350ebcae1e96698721c0400fb7f.zip
Cleaning up effects.core _normalizeArguments a bit more
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.effects.core.js30
1 files changed, 18 insertions, 12 deletions
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js
index 84e730889..6618a2236 100644
--- a/ui/jquery.effects.core.js
+++ b/ui/jquery.effects.core.js
@@ -412,41 +412,47 @@ $.extend($.effects, {
// return an effect options object for the given parameters:
function _normalizeArguments( effect, options, speed, callback ) {
- var effectObj = {
- effect: effect
- };
- // passed an effect options object:
+ // short path for passing an effect options object:
if ( $.isPlainObject( effect ) ) {
return effect;
}
- if ( $.isFunction(options) ) {
+ // convert to an object
+ effect = { effect: effect };
+
+ // catch (effect, callback)
+ if ( $.isFunction( options ) ) {
callback = options;
speed = null;
options = {};
}
- if (typeof options == 'number' || $.fx.speeds[options]) {
+
+ // catch (effect, speed, ?)
+ if ( $.type( options ) == 'number' || $.fx.speeds[ options ]) {
callback = speed;
speed = options;
options = {};
}
- if ( $.isFunction(speed) ) {
+
+ // catch (effect, options, callback)
+ if ( $.isFunction( speed ) ) {
callback = speed;
speed = null;
}
+ // add options to effect
if ( options ) {
- $.extend( effectObj, options );
+ $.extend( effect, options );
}
speed = speed || options.duration;
- effectObj.duration = $.fx.off ? 0 : typeof speed == 'number'
- ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;
+ effect.duration = $.fx.off ? 0 : typeof speed == 'number'
+ ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default;
- effectObj.complete = callback || options.complete;
+ effect.complete = callback || options.complete;
- return effectObj;
+ return effect;
}
function standardSpeed( speed ) {