diff --git a/src/effects.js b/src/effects.js index b439d8d58d..e3ccefff61 100644 --- a/src/effects.js +++ b/src/effects.js @@ -610,8 +610,11 @@ jQuery.fx.tick = function() { }; jQuery.fx.timer = function( timer ) { - if ( timer() && jQuery.timers.push( timer ) ) { + jQuery.timers.push( timer ); + if ( timer() ) { jQuery.fx.start(); + } else { + jQuery.timers.pop(); } }; diff --git a/test/unit/effects.js b/test/unit/effects.js index 1645842c49..318010b182 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1550,6 +1550,21 @@ test("Animation callback should not show animated element as :animated (#7157)", this.clock.tick( 100 ); }); +test("Initial step callback should show element as :animated (#14623)", 1, function() { + var foo = jQuery( "#foo" ); + + foo.animate({ + opacity: 0, + }, { + duration: 100, + step: function() { + ok( foo.is(":animated"), "The element matches :animated inside step function" ); + } + }); + this.clock.tick( 1 ); + foo.stop(); +}); + test( "hide called on element within hidden parent should set display to none (#10045)", 3, function() { var hidden = jQuery(".hidden"), elems = jQuery("
hide
hide0
hide1
");