xonecas.io
286
Sf

simple-flask-coffee-sass-boilerplate / files

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

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