Skip to content

Commit 0858144

Browse files
committed
Effects: First step() call should match :animated selector
Fixes #14623 Closes jquerygh-1473
1 parent 5801c3a commit 0858144

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/effects.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,11 @@ jQuery.fx.tick = function() {
610610
};
611611

612612
jQuery.fx.timer = function( timer ) {
613-
if ( timer() && jQuery.timers.push( timer ) ) {
613+
jQuery.timers.push( timer );
614+
if ( timer() ) {
614615
jQuery.fx.start();
616+
} else {
617+
jQuery.timers.pop();
615618
}
616619
};
617620

test/unit/effects.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,21 @@ test("Animation callback should not show animated element as :animated (#7157)",
15501550
this.clock.tick( 100 );
15511551
});
15521552

1553+
test("Initial step callback should show element as :animated (#14623)", 1, function() {
1554+
var foo = jQuery( "#foo" );
1555+
1556+
foo.animate({
1557+
opacity: 0,
1558+
}, {
1559+
duration: 100,
1560+
step: function() {
1561+
ok( foo.is(":animated"), "The element matches :animated inside step function" );
1562+
}
1563+
});
1564+
this.clock.tick( 1 );
1565+
foo.stop();
1566+
});
1567+
15531568
test( "hide called on element within hidden parent should set display to none (#10045)", 3, function() {
15541569
var hidden = jQuery(".hidden"),
15551570
elems = jQuery("<div>hide</div><div>hide0</div><div>hide1</div>");

0 commit comments

Comments
 (0)