File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -614,6 +614,8 @@ jQuery.fx.tick = function() {
614
614
timers = jQuery . timers ,
615
615
i = 0 ;
616
616
617
+ fxNow = jQuery . now ( ) ;
618
+
617
619
for ( ; i < timers . length ; i ++ ) {
618
620
timer = timers [ i ] ;
619
621
// Checks the timer has not already been removed
@@ -625,6 +627,7 @@ jQuery.fx.tick = function() {
625
627
if ( ! timers . length ) {
626
628
jQuery . fx . stop ( ) ;
627
629
}
630
+ fxNow = undefined ;
628
631
} ;
629
632
630
633
jQuery . fx . timer = function ( timer ) {
Original file line number Diff line number Diff line change @@ -1811,6 +1811,35 @@ test( "Animate properly sets overflow hidden when animating width/height (#12117
1811
1811
} ) ;
1812
1812
} ) ;
1813
1813
1814
+ test ( "Each tick of the timer loop uses a fresh time (#12837)" , function ( ) {
1815
+ var lastVal , current ,
1816
+ tmp = jQuery ( {
1817
+ test : 0
1818
+ } ) ;
1819
+ expect ( 3 ) ;
1820
+ tmp . animate ( {
1821
+ test : 100
1822
+ } , {
1823
+ step : function ( p , fx ) {
1824
+ ok ( fx . now !== lastVal , "Current value is not the last value: " + lastVal + " - " + fx . now ) ;
1825
+ lastVal = fx . now ;
1826
+ }
1827
+ } ) ;
1828
+ current = jQuery . now ( ) ;
1829
+ // intentionally empty, we want to spin wheels until the time changes.
1830
+ while ( current === jQuery . now ( ) ) { }
1831
+
1832
+ // now that we have a new time, run another tick
1833
+ jQuery . fx . tick ( ) ;
1834
+
1835
+ current = jQuery . now ( ) ;
1836
+ // intentionally empty, we want to spin wheels until the time changes.
1837
+ while ( current === jQuery . now ( ) ) { }
1838
+
1839
+ jQuery . fx . tick ( ) ;
1840
+ tmp . stop ( ) ;
1841
+ } ) ;
1842
+
1814
1843
test ( "Animations with 0 duration don't ease (#12273)" , 1 , function ( ) {
1815
1844
jQuery . easing . test = function ( ) {
1816
1845
ok ( false , "Called easing" ) ;
You can’t perform that action at this time.
0 commit comments