Blame view

bower_components/jquery/src/css/support.js 3.12 KB
c5169e0e   Renato De Donato   a new hope
1
  define([
74249687   Luigi Serra   Cross browser con...
2
  	"../core",
74249687   Luigi Serra   Cross browser con...
3
  	"../var/support"
c5169e0e   Renato De Donato   a new hope
4
  ], function( jQuery, support ) {
74249687   Luigi Serra   Cross browser con...
5
  
c5169e0e   Renato De Donato   a new hope
6
7
8
  (function() {
  	var pixelPositionVal, boxSizingReliableVal,
  		docElem = document.documentElement,
74249687   Luigi Serra   Cross browser con...
9
10
11
  		container = document.createElement( "div" ),
  		div = document.createElement( "div" );
  
74249687   Luigi Serra   Cross browser con...
12
13
14
15
16
17
18
19
20
21
  	if ( !div.style ) {
  		return;
  	}
  
  	// Support: IE9-11+
  	// Style of cloned element affects source element cloned (#8908)
  	div.style.backgroundClip = "content-box";
  	div.cloneNode( true ).style.backgroundClip = "";
  	support.clearCloneStyle = div.style.backgroundClip === "content-box";
  
c5169e0e   Renato De Donato   a new hope
22
23
  	container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
  		"position:absolute";
74249687   Luigi Serra   Cross browser con...
24
25
26
27
  	container.appendChild( div );
  
  	// Executing both pixelPosition & boxSizingReliable tests require only one layout
  	// so they're executed at the same time to save the second computation.
c5169e0e   Renato De Donato   a new hope
28
  	function computePixelPositionAndBoxSizingReliable() {
74249687   Luigi Serra   Cross browser con...
29
  		div.style.cssText =
74249687   Luigi Serra   Cross browser con...
30
31
  			// Support: Firefox<29, Android 2.3
  			// Vendor-prefix box-sizing
c5169e0e   Renato De Donato   a new hope
32
33
34
  			"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
  			"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
  			"border:1px;padding:1px;width:4px;position:absolute";
74249687   Luigi Serra   Cross browser con...
35
  		div.innerHTML = "";
c5169e0e   Renato De Donato   a new hope
36
  		docElem.appendChild( container );
74249687   Luigi Serra   Cross browser con...
37
  
c5169e0e   Renato De Donato   a new hope
38
  		var divStyle = window.getComputedStyle( div, null );
74249687   Luigi Serra   Cross browser con...
39
  		pixelPositionVal = divStyle.top !== "1%";
74249687   Luigi Serra   Cross browser con...
40
41
  		boxSizingReliableVal = divStyle.width === "4px";
  
c5169e0e   Renato De Donato   a new hope
42
  		docElem.removeChild( container );
74249687   Luigi Serra   Cross browser con...
43
44
  	}
  
c5169e0e   Renato De Donato   a new hope
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  	// Support: node.js jsdom
  	// Don't assume that getComputedStyle is a property of the global object
  	if ( window.getComputedStyle ) {
  		jQuery.extend( support, {
  			pixelPosition: function() {
  
  				// This test is executed only once but we still do memoizing
  				// since we can use the boxSizingReliable pre-computing.
  				// No need to check if the test was already performed, though.
  				computePixelPositionAndBoxSizingReliable();
  				return pixelPositionVal;
  			},
  			boxSizingReliable: function() {
  				if ( boxSizingReliableVal == null ) {
  					computePixelPositionAndBoxSizingReliable();
  				}
  				return boxSizingReliableVal;
  			},
  			reliableMarginRight: function() {
a1a3bc73   Luigi Serra   graphs updates
64
65
  
  				// Support: Android 2.3
c5169e0e   Renato De Donato   a new hope
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
  				// Check if div with explicit width and no margin-right incorrectly
  				// gets computed margin-right based on width of container. (#3333)
  				// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  				// This support function is only executed once so no memoizing is needed.
  				var ret,
  					marginDiv = div.appendChild( document.createElement( "div" ) );
  
  				// Reset CSS: box-sizing; display; margin; border; padding
  				marginDiv.style.cssText = div.style.cssText =
  					// Support: Firefox<29, Android 2.3
  					// Vendor-prefix box-sizing
  					"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
  					"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
  				marginDiv.style.marginRight = marginDiv.style.width = "0";
  				div.style.width = "1px";
  				docElem.appendChild( container );
  
  				ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
  
  				docElem.removeChild( container );
  				div.removeChild( marginDiv );
  
  				return ret;
  			}
  		});
  	}
  })();
74249687   Luigi Serra   Cross browser con...
93
94
95
  
  return support;
  
c5169e0e   Renato De Donato   a new hope
96
  });