xonecas.io
286
Sf

simple-flask-coffee-sass-boilerplate / files

simple-flask-coffee-sass-boilerplate / bower_components / jquery / src / css / curCSS.js

1.4 KB
1define([
2	"../core",
3	"./var/rnumnonpx",
4	"./var/rmargin",
5	"./var/getStyles",
6	"../selector" // contains
7], function( jQuery, rnumnonpx, rmargin, getStyles ) {
8
9function 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') in IE9, see #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
56return curCSS;
57});