Blame view

app/bower_components/jquery/src/css/curCSS.js 1.47 KB
87c93a029   Dang YoungWorld   add modal
1
  define( [
f986e111b   TRUONG   add libs
2
3
4
  	"../core",
  	"./var/rnumnonpx",
  	"./var/rmargin",
87c93a029   Dang YoungWorld   add modal
5
6
7
8
  	"./var/getStyles",
  	"./support",
  	"../selector" // Get jQuery.contains
  ], function( jQuery, rnumnonpx, rmargin, getStyles, support ) {
f986e111b   TRUONG   add libs
9

87c93a029   Dang YoungWorld   add modal
10
  "use strict";
f986e111b   TRUONG   add libs
11

87c93a029   Dang YoungWorld   add modal
12
13
14
  function curCSS( elem, name, computed ) {
  	var width, minWidth, maxWidth, ret,
  		style = elem.style;
f986e111b   TRUONG   add libs
15

87c93a029   Dang YoungWorld   add modal
16
  	computed = computed || getStyles( elem );
f986e111b   TRUONG   add libs
17

87c93a029   Dang YoungWorld   add modal
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   TRUONG   add libs
22

87c93a029   Dang YoungWorld   add modal
23
24
  		if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  			ret = jQuery.style( elem, name );
f986e111b   TRUONG   add libs
25
  		}
87c93a029   Dang YoungWorld   add modal
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   TRUONG   add libs
32
33
  
  			// Remember the original values
87c93a029   Dang YoungWorld   add modal
34
35
36
  			width = style.width;
  			minWidth = style.minWidth;
  			maxWidth = style.maxWidth;
f986e111b   TRUONG   add libs
37
38
  
  			// Put in the new values to get a computed value out
87c93a029   Dang YoungWorld   add modal
39
40
  			style.minWidth = style.maxWidth = style.width = ret;
  			ret = computed.width;
f986e111b   TRUONG   add libs
41
42
  
  			// Revert the changed values
87c93a029   Dang YoungWorld   add modal
43
44
45
  			style.width = width;
  			style.minWidth = minWidth;
  			style.maxWidth = maxWidth;
f986e111b   TRUONG   add libs
46
  		}
87c93a029   Dang YoungWorld   add modal
47
  	}
f986e111b   TRUONG   add libs
48

87c93a029   Dang YoungWorld   add modal
49
50
51
  	return ret !== undefined ?
  
  		// Support: IE <=9 - 11 only
f986e111b   TRUONG   add libs
52
  		// IE returns zIndex value as an integer.
87c93a029   Dang YoungWorld   add modal
53
54
  		ret + "" :
  		ret;
f986e111b   TRUONG   add libs
55
  }
87c93a029   Dang YoungWorld   add modal
56
57
  return curCSS;
  } );