Commit 0fea007a authored by Corey Frang's avatar Corey Frang Committed by Dave Methvin

Fix #12273. Don't call easing functions for duration 0 animations. Close gh-895.

parent 3812f943
...@@ -376,7 +376,13 @@ Tween.prototype = { ...@@ -376,7 +376,13 @@ Tween.prototype = {
var eased, var eased,
hooks = Tween.propHooks[ this.prop ]; 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; this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) { if ( this.options.step ) {
......
...@@ -1811,4 +1811,22 @@ test( "Animate properly sets overflow hidden when animating width/height (#12117 ...@@ -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 ) } // if ( jQuery.fx )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment