diff options
author | gnarf <gnarf@gnarf.net> | 2011-06-21 01:11:46 -0500 |
---|---|---|
committer | gnarf <gnarf@gnarf.net> | 2011-06-21 01:18:19 -0500 |
commit | ab627e03a6a37cbf3291e9600f5482bd50991360 (patch) | |
tree | cda0933741895ef198be19813cb45168889ea78f /ui/jquery.effects.scale.js | |
parent | 65a6c46e5568c43a9df9505e23da6a766814557e (diff) | |
download | jquery-ui-ab627e03a6a37cbf3291e9600f5482bd50991360.tar.gz jquery-ui-ab627e03a6a37cbf3291e9600f5482bd50991360.zip |
Effects.*: DRY the complete callback execution into the 'done' callback passed into an effect
Diffstat (limited to 'ui/jquery.effects.scale.js')
-rw-r--r-- | ui/jquery.effects.scale.js | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index 2642c6c1d..000fdee28 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -12,16 +12,7 @@ */ (function( $, undefined ) { -function compFunction( el, complete, next ) { - return function() { - if ( $.isFunction( complete ) ) { - complete.apply( el ); - } - next(); - }; -}; - -$.effects.effect.puff = function( o, next ) { +$.effects.effect.puff = function( o, done ) { var elem = $( this ), mode = $.effects.setMode( elem, o.mode || "hide" ), hide = mode === "hide", @@ -37,7 +28,7 @@ $.effects.effect.puff = function( o, next ) { queue: false, fade: true, mode: mode, - complete: compFunction( this, o.complete, next ), + complete: done, percent: hide ? percent : 100, from: hide ? original @@ -50,7 +41,7 @@ $.effects.effect.puff = function( o, next ) { elem.effect( o ); }; -$.effects.effect.scale = function( o, next ) { +$.effects.effect.scale = function( o, done ) { // Create element var el = $( this ), @@ -73,7 +64,7 @@ $.effects.effect.scale = function( o, next ) { // We are going to pass this effect to the size effect: options.effect = "size"; options.queue = false; - options.complete = compFunction( this, options.complete, next ); + options.complete = done; // Set default origin and restore for show/hide if ( mode != "effect" ) { @@ -105,7 +96,7 @@ $.effects.effect.scale = function( o, next ) { }; -$.effects.effect.size = function( o, next ) { +$.effects.effect.size = function( o, done ) { // Create element var el = $( this ), @@ -302,10 +293,7 @@ $.effects.effect.size = function( o, next ) { } $.effects.removeWrapper( el ); - if ( $.isFunction( o.complete ) ) { - o.complete.apply( this, arguments ); - } - next(); + done(); } }); |