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() {
614614 timers = jQuery . timers ,
615615 i = 0 ;
616616
617+ fxNow = jQuery . now ( ) ;
618+
617619 for ( ; i < timers . length ; i ++ ) {
618620 timer = timers [ i ] ;
619621 // Checks the timer has not already been removed
@@ -625,6 +627,7 @@ jQuery.fx.tick = function() {
625627 if ( ! timers . length ) {
626628 jQuery . fx . stop ( ) ;
627629 }
630+ fxNow = undefined ;
628631} ;
629632
630633jQuery . 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
18111811 } ) ;
18121812} ) ;
18131813
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+
18141843test ( "Animations with 0 duration don't ease (#12273)" , 1 , function ( ) {
18151844 jQuery . easing . test = function ( ) {
18161845 ok ( false , "Called easing" ) ;
You can’t perform that action at this time.
0 commit comments