Blame view
app/bower_components/jquery/src/css/curCSS.js
1.47 KB
87c93a029
|
1 |
define( [ |
f986e111b
|
2 3 4 |
"../core", "./var/rnumnonpx", "./var/rmargin", |
87c93a029
|
5 6 7 8 |
"./var/getStyles", "./support", "../selector" // Get jQuery.contains ], function( jQuery, rnumnonpx, rmargin, getStyles, support ) { |
f986e111b
|
9 |
|
87c93a029
|
10 |
"use strict"; |
f986e111b
|
11 |
|
87c93a029
|
12 13 14 |
function curCSS( elem, name, computed ) { var width, minWidth, maxWidth, ret, style = elem.style; |
f986e111b
|
15 |
|
87c93a029
|
16 |
computed = computed || getStyles( elem ); |
f986e111b
|
17 |
|
87c93a029
|
18 19 20 21 |
// Support: IE <=9 only // getPropertyValue is only needed for .css('filter') (#12537) if ( computed ) { ret = computed.getPropertyValue( name ) || computed[ name ]; |
f986e111b
|
22 |
|
87c93a029
|
23 24 |
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); |
f986e111b
|
25 |
} |
87c93a029
|
26 27 28 29 30 31 |
// A tribute to the "awesome hack by Dean Edwards" // Android Browser returns percentage for some values, // but width seems to be reliably pixels. // This is against the CSSOM draft spec: // https://drafts.csswg.org/cssom/#resolved-values if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { |
f986e111b
|
32 33 |
// Remember the original values |
87c93a029
|
34 35 36 |
width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; |
f986e111b
|
37 38 |
// Put in the new values to get a computed value out |
87c93a029
|
39 40 |
style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; |
f986e111b
|
41 42 |
// Revert the changed values |
87c93a029
|
43 44 45 |
style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; |
f986e111b
|
46 |
} |
87c93a029
|
47 |
} |
f986e111b
|
48 |
|
87c93a029
|
49 50 51 |
return ret !== undefined ? // Support: IE <=9 - 11 only |
f986e111b
|
52 |
// IE returns zIndex value as an integer. |
87c93a029
|
53 54 |
ret + "" : ret; |
f986e111b
|
55 |
} |
87c93a029
|
56 57 |
return curCSS; } ); |