4 "../var/documentElement",
6 ], function( jQuery, document, documentElement, support ) {
12 // Executing both pixelPosition & boxSizingReliable tests require only one layout
13 // so they're executed at the same time to save the second computation.
14 function computeStyleTests() {
16 // This is a singleton, we need to execute it only once
22 "box-sizing:border-box;" +
23 "position:relative;display:block;" +
24 "margin:auto;border:1px;padding:1px;" +
27 documentElement.appendChild( container );
29 var divStyle = window.getComputedStyle( div );
30 pixelPositionVal = divStyle.top !== "1%";
32 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
33 reliableMarginLeftVal = divStyle.marginLeft === "2px";
34 boxSizingReliableVal = divStyle.width === "4px";
36 // Support: Android 4.0 - 4.3 only
37 // Some styles come back with percentage values, even though they shouldn't
38 div.style.marginRight = "50%";
39 pixelMarginRightVal = divStyle.marginRight === "4px";
41 documentElement.removeChild( container );
43 // Nullify the div so it wouldn't be stored in the memory and
44 // it will also be a sign that checks already performed
48 var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
49 container = document.createElement( "div" ),
50 div = document.createElement( "div" );
52 // Finish early in limited (non-browser) environments
57 // Support: IE <=9 - 11 only
58 // Style of cloned element affects source element cloned (#8908)
59 div.style.backgroundClip = "content-box";
60 div.cloneNode( true ).style.backgroundClip = "";
61 support.clearCloneStyle = div.style.backgroundClip === "content-box";
63 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
64 "padding:0;margin-top:1px;position:absolute";
65 container.appendChild( div );
67 jQuery.extend( support, {
68 pixelPosition: function() {
70 return pixelPositionVal;
72 boxSizingReliable: function() {
74 return boxSizingReliableVal;
76 pixelMarginRight: function() {
78 return pixelMarginRightVal;
80 reliableMarginLeft: function() {
82 return reliableMarginLeftVal;