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