aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2013-12-24 15:59:37 -0500
committerDave Methvin <dave.methvin@gmail.com>2014-01-09 22:29:05 -0500
commit09b28534fa0d9a85d4618ddca163ce187ee50d63 (patch)
treee0ff2ad63e77046817cb712ee73917eb9a1860b7
parentab1224dd2df0efd67655a142c8a478cdcc7b27ad (diff)
downloadjquery-09b28534fa0d9a85d4618ddca163ce187ee50d63.tar.gz
jquery-09b28534fa0d9a85d4618ddca163ce187ee50d63.zip
Effects: First step() call should match :animated selector
(cherry picked from commit 085814474e4a854d533b5ccbaef24c090081e0c4) Fixes #14623 Closes gh-1473
-rw-r--r--src/effects.js5
-rw-r--r--test/unit/effects.js15
2 files changed, 19 insertions, 1 deletions
diff --git a/src/effects.js b/src/effects.js
index bd2e4eef9..c843549c2 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -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();
}
};
diff --git a/test/unit/effects.js b/test/unit/effects.js
index acbc776fb..4f75dddf2 100644
--- a/test/unit/effects.js
+++ b/test/unit/effects.js
@@ -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>");