4 ], function( jQuery, rcssNum ) {
6 function adjustCSS( elem, prop, valueParts, tween ) {
10 currentValue = tween ?
11 function() { return tween.cur(); } :
12 function() { return jQuery.css( elem, prop, "" ); },
13 initial = currentValue(),
14 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
16 // Starting value computation is required for potential unit mismatches
17 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
18 rcssNum.exec( jQuery.css( elem, prop ) );
20 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
22 // Trust units reported by jQuery.css
23 unit = unit || initialInUnit[ 3 ];
25 // Make sure we update the tween properties later on
26 valueParts = valueParts || [];
28 // Iteratively approximate from a nonzero starting point
29 initialInUnit = +initial || 1;
33 // If previous iteration zeroed out, double until we get *something*.
34 // Use string for doubling so we don't accidentally see scale as unchanged below
35 scale = scale || ".5";
38 initialInUnit = initialInUnit / scale;
39 jQuery.style( elem, prop, initialInUnit + unit );
41 // Update scale, tolerating zero or NaN from tween.cur()
42 // Break the loop if scale is unchanged or perfect, or if we've just had enough.
44 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
49 initialInUnit = +initialInUnit || +initial || 0;
51 // Apply relative offset (+=/-=) if specified
52 adjusted = valueParts[ 1 ] ?
53 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
57 tween.start = initialInUnit;