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 @@ -612,6 +612,8 @@ jQuery.fx.tick = function() {
612612 timers = jQuery . timers ,
613613 i = 0 ;
614614
615+ fxNow = jQuery . now ( ) ;
616+
615617 for ( ; i < timers . length ; i ++ ) {
616618 timer = timers [ i ] ;
617619 // Checks the timer has not already been removed
@@ -623,6 +625,7 @@ jQuery.fx.tick = function() {
623625 if ( ! timers . length ) {
624626 jQuery . fx . stop ( ) ;
625627 }
628+ fxNow = undefined ;
626629} ;
627630
628631jQuery . fx . timer = function ( timer ) {
Original file line number Diff line number Diff line change @@ -1818,6 +1818,35 @@ test( "Animate properly sets overflow hidden when animating width/height (#12117
18181818 } ) ;
18191819} ) ;
18201820
1821+ test ( "Each tick of the timer loop uses a fresh time (#12837)" , function ( ) {
1822+ var lastVal , current ,
1823+ tmp = jQuery ( {
1824+ test : 0
1825+ } ) ;
1826+ expect ( 3 ) ;
1827+ tmp . animate ( {
1828+ test : 100
1829+ } , {
1830+ step : function ( p , fx ) {
1831+ ok ( fx . now !== lastVal , "Current value is not the last value: " + lastVal + " - " + fx . now ) ;
1832+ lastVal = fx . now ;
1833+ }
1834+ } ) ;
1835+ current = jQuery . now ( ) ;
1836+ // intentionally empty, we want to spin wheels until the time changes.
1837+ while ( current === jQuery . now ( ) ) { }
1838+
1839+ // now that we have a new time, run another tick
1840+ jQuery . fx . tick ( ) ;
1841+
1842+ current = jQuery . now ( ) ;
1843+ // intentionally empty, we want to spin wheels until the time changes.
1844+ while ( current === jQuery . now ( ) ) { }
1845+
1846+ jQuery . fx . tick ( ) ;
1847+ tmp . stop ( ) ;
1848+ } ) ;
1849+
18211850test ( "Animations with 0 duration don't ease (#12273)" , 1 , function ( ) {
18221851 jQuery . easing . test = function ( ) {
18231852 ok ( false , "Called easing" ) ;
You can’t perform that action at this time.
0 commit comments