@@ -5,12 +5,13 @@ var fxNow, timerId,
5
5
animationPrefilters = [ defaultPrefilter ] ,
6
6
tweeners = {
7
7
"*" : [ function ( prop , value ) {
8
- var end , unit , prevScale ,
8
+ var end , unit ,
9
9
tween = this . createTween ( prop , value ) ,
10
10
parts = rfxnum . exec ( value ) ,
11
11
target = tween . cur ( ) ,
12
12
start = + target || 0 ,
13
- scale = 1 ;
13
+ scale = 1 ,
14
+ maxIterations = 20 ;
14
15
15
16
if ( parts ) {
16
17
end = + parts [ 2 ] ;
@@ -26,17 +27,15 @@ var fxNow, timerId,
26
27
do {
27
28
// If previous iteration zeroed out, double until we get *something*
28
29
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
29
- prevScale = scale = scale || ".5" ;
30
+ scale = scale || ".5" ;
30
31
31
32
// Adjust and apply
32
33
start = start / scale ;
33
34
jQuery . style ( tween . elem , prop , start + unit ) ;
34
35
35
- // Update scale, tolerating zeroes from tween.cur()
36
- scale = tween . cur ( ) / target ;
37
-
38
- // Stop looping if we've hit the mark or scale is unchanged
39
- } while ( scale !== 1 && scale !== prevScale ) ;
36
+ // Update scale, tolerating zero or NaN from tween.cur()
37
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
38
+ } while ( scale !== ( scale = tween . cur ( ) / target ) && scale !== 1 && -- maxIterations ) ;
40
39
}
41
40
42
41
tween . unit = unit ;
0 commit comments