]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/space-pen/node_modules/jquery/src/css/curCSS.js
90e508cb8ce4feb8bb9c6765c138b8b3cb011c06
[rbdr/dotfiles] / atom / packages / ex-mode / node_modules / space-pen / node_modules / jquery / src / css / curCSS.js
1 define([
2 "../core",
3 "./var/rnumnonpx",
4 "./var/rmargin",
5 "./var/getStyles",
6 "../selector" // contains
7 ], function( jQuery, rnumnonpx, rmargin, getStyles ) {
8
9 function curCSS( elem, name, computed ) {
10 var width, minWidth, maxWidth, ret,
11 style = elem.style;
12
13 computed = computed || getStyles( elem );
14
15 // Support: IE9
16 // getPropertyValue is only needed for .css('filter') (#12537)
17 if ( computed ) {
18 ret = computed.getPropertyValue( name ) || computed[ name ];
19 }
20
21 if ( computed ) {
22
23 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
24 ret = jQuery.style( elem, name );
25 }
26
27 // Support: iOS < 6
28 // A tribute to the "awesome hack by Dean Edwards"
29 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
30 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
31 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
32
33 // Remember the original values
34 width = style.width;
35 minWidth = style.minWidth;
36 maxWidth = style.maxWidth;
37
38 // Put in the new values to get a computed value out
39 style.minWidth = style.maxWidth = style.width = ret;
40 ret = computed.width;
41
42 // Revert the changed values
43 style.width = width;
44 style.minWidth = minWidth;
45 style.maxWidth = maxWidth;
46 }
47 }
48
49 return ret !== undefined ?
50 // Support: IE
51 // IE returns zIndex value as an integer.
52 ret + "" :
53 ret;
54 }
55
56 return curCSS;
57 });