]> source.dussan.org Git - jquery.git/commitdiff
Effects: First step() call should match :animated selector
authorDave Methvin <dave.methvin@gmail.com>
Tue, 24 Dec 2013 20:59:37 +0000 (15:59 -0500)
committerDave Methvin <dave.methvin@gmail.com>
Fri, 10 Jan 2014 03:29:05 +0000 (22:29 -0500)
(cherry picked from commit 085814474e4a854d533b5ccbaef24c090081e0c4)

Fixes #14623
Closes gh-1473

src/effects.js
test/unit/effects.js

index bd2e4eef944139e33e68a329a05d14e4add6ca67..c843549c2095666e7f288da3bba54b5e1194b3c3 100644 (file)
@@ -616,8 +616,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();
        }
 };
 
index acbc776fbfcf6f50f851525829edc2acc95ae864..4f75dddf252e7999626d4822b8a6012913e7688a 100644 (file)
@@ -1608,6 +1608,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("<div>hide</div><div>hide0</div><div>hide1</div>");