diff options
author | Corey Frang <gnarf@gnarf.net> | 2012-08-15 14:31:37 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-08-19 22:09:08 -0400 |
commit | 0fea007a1a4d6456a8c7d246e4f7a4e14a1ba04a (patch) | |
tree | 8998f8e3fc0264c4eeb55b89ee6bc01ab2f68e6e | |
parent | 3812f9436da09d9f31ca4a61a14cd70f3e8cbeaf (diff) | |
download | jquery-0fea007a1a4d6456a8c7d246e4f7a4e14a1ba04a.tar.gz jquery-0fea007a1a4d6456a8c7d246e4f7a4e14a1ba04a.zip |
Fix #12273. Don't call easing functions for duration 0 animations. Close gh-895.
-rw-r--r-- | src/effects.js | 8 | ||||
-rw-r--r-- | test/unit/effects.js | 18 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/effects.js b/src/effects.js index 3405cfdc2..cc2a26a1e 100644 --- a/src/effects.js +++ b/src/effects.js @@ -376,7 +376,13 @@ Tween.prototype = { var eased, hooks = Tween.propHooks[ this.prop ]; - this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration ); + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { diff --git a/test/unit/effects.js b/test/unit/effects.js index 0eb2a3156..70b181461 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1811,4 +1811,22 @@ test( "Animate properly sets overflow hidden when animating width/height (#12117 }); }); +test( "Animations with 0 duration don't ease (#12273)", 1, function() { + jQuery.easing.test = function() { + ok( false, "Called easing" ); + }; + + jQuery( "#foo" ).animate({ + height: 100 + }, { + duration: 0, + easing: "test", + complete: function() { + equal( jQuery( this ).height(), 100, "Height is 100" ); + } + }); + + delete jQuery.easing.test; +}); + } // if ( jQuery.fx ) |