diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2012-06-26 13:48:31 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-07-05 21:38:17 -0400 |
commit | 1793eab32bc8a00b2ad041c9b10ad3bdd2bec702 (patch) | |
tree | 306168bf4d6ba1c284edea56fa18fe597a468da6 /src | |
parent | 86b775d036627ebd7242fbb4eb9f24e4ba1fa9c5 (diff) | |
download | jquery-1793eab32bc8a00b2ad041c9b10ad3bdd2bec702.tar.gz jquery-1793eab32bc8a00b2ad041c9b10ad3bdd2bec702.zip |
Fix #11971: force numeric animation start to be numeric, closes gh-836.
Diffstat (limited to 'src')
-rw-r--r-- | src/effects.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/effects.js b/src/effects.js index f1bbed763..0716248f1 100644 --- a/src/effects.js +++ b/src/effects.js @@ -1,6 +1,6 @@ var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, - rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, + rfxnum = /^(?:([\-+])=)?([\d+.\-]+)([a-z%]*)$/i, rrun = /queueHooks$/, animationPrefilters = [ defaultPrefilter ], tweeners = { @@ -8,9 +8,9 @@ var fxNow, timerId, var end, unit, prevScale, tween = this.createTween( prop, value ), parts = rfxnum.exec( value ), - start = tween.cur(), - scale = 1, - target = start; + target = tween.cur(), + start = +target || 0, + scale = 1; if ( parts ) { end = +parts[2]; @@ -21,7 +21,7 @@ var fxNow, timerId, // Iteratively approximate from a nonzero starting point // Prefer the current property, because this process will be trivial if it uses the same units // Fallback to end or a simple constant - start = parseFloat( jQuery.css( tween.elem, prop ) ) || end || 1; + start = jQuery.css( tween.elem, prop, true ) || end || 1; do { // If previous iteration zeroed out, double until we get *something* @@ -35,14 +35,14 @@ var fxNow, timerId, // Update scale, tolerating zeroes from tween.cur() scale = tween.cur() / target; - // Stop looping if scale is unchanged or we've hit the mark + // Stop looping if we've hit the mark or scale is unchanged } while ( scale !== 1 && scale !== prevScale ); } tween.unit = unit; tween.start = start; // If a +=/-= token was provided, we're doing a relative animation - tween.end = parts[1] ? start + end * ( parts[1] === "-=" ? -1 : 1 ) : end; + tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; } return tween; }] |