Skip to content
Permalink
Browse files
Fix #12273. Don't call easing functions for duration 0 animations. Close
  • Loading branch information
gnarf authored and dmethvin committed Aug 20, 2012
1 parent 3812f94 commit 0fea007
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
@@ -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 ) {
@@ -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 )

0 comments on commit 0fea007

Please sign in to comment.