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 15, 2012
1 parent 3812f94 commit 0fea007a1a4d6456a8c7d246e4f7a4e14a1ba04a
Showing with 25 additions and 1 deletion.
  1. +7 −1 src/effects.js
  2. +18 −0 test/unit/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 ) {
@@ -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.
You can’t perform that action at this time.