nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / jquery / src / css / adjustCSS.js
1 define( [
2         "../core",
3         "../var/rcssNum"
4 ], function( jQuery, rcssNum ) {
5
6 function adjustCSS( elem, prop, valueParts, tween ) {
7         var adjusted,
8                 scale = 1,
9                 maxIterations = 20,
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" ),
15
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 ) );
19
20         if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
21
22                 // Trust units reported by jQuery.css
23                 unit = unit || initialInUnit[ 3 ];
24
25                 // Make sure we update the tween properties later on
26                 valueParts = valueParts || [];
27
28                 // Iteratively approximate from a nonzero starting point
29                 initialInUnit = +initial || 1;
30
31                 do {
32
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";
36
37                         // Adjust and apply
38                         initialInUnit = initialInUnit / scale;
39                         jQuery.style( elem, prop, initialInUnit + unit );
40
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.
43                 } while (
44                         scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
45                 );
46         }
47
48         if ( valueParts ) {
49                 initialInUnit = +initialInUnit || +initial || 0;
50
51                 // Apply relative offset (+=/-=) if specified
52                 adjusted = valueParts[ 1 ] ?
53                         initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
54                         +valueParts[ 2 ];
55                 if ( tween ) {
56                         tween.unit = unit;
57                         tween.start = initialInUnit;
58                         tween.end = adjusted;
59                 }
60         }
61         return adjusted;
62 }
63
64 return adjustCSS;
65 } );