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
21 container
.style
.cssText
= "position:absolute;left:-11111px;width:60px;" +
22 "margin-top:1px;padding:0;border:0";
24 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
25 "margin:auto;border:1px;padding:1px;" +
27 documentElement
.appendChild( container
).appendChild( div
);
29 var divStyle
= window
.getComputedStyle( div
);
30 pixelPositionVal
= divStyle
.top
!== "1%";
32 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
33 reliableMarginLeftVal
= roundPixelMeasures( divStyle
.marginLeft
) === 12;
35 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
36 // Some styles come back with percentage values, even though they shouldn't
37 div
.style
.right
= "60%";
38 pixelBoxStylesVal
= roundPixelMeasures( divStyle
.right
) === 36;
40 // Support: IE 9 - 11 only
41 // Detect misreporting of content dimensions for box-sizing:border-box elements
42 boxSizingReliableVal
= roundPixelMeasures( divStyle
.width
) === 36;
45 // Detect overflow:scroll screwiness (gh-3699)
46 // Support: Chrome <=64
47 // Don't get tricked when zoom affects offsetWidth (gh-4029)
48 div
.style
.position
= "absolute";
49 scrollboxSizeVal
= roundPixelMeasures( div
.offsetWidth
/ 3 ) === 12 || "absolute";
51 documentElement
.removeChild( container
);
53 // Nullify the div so it wouldn't be stored in the memory and
54 // it will also be a sign that checks already performed
58 function roundPixelMeasures( measure
) {
59 return Math
.round( parseFloat( measure
) );
62 var pixelPositionVal
, boxSizingReliableVal
, scrollboxSizeVal
, pixelBoxStylesVal
,
63 reliableMarginLeftVal
,
64 container
= document
.createElement( "div" ),
65 div
= document
.createElement( "div" );
67 // Finish early in limited (non-browser) environments
72 // Support: IE <=9 - 11 only
73 // Style of cloned element affects source element cloned (#8908)
74 div
.style
.backgroundClip
= "content-box";
75 div
.cloneNode( true ).style
.backgroundClip
= "";
76 support
.clearCloneStyle
= div
.style
.backgroundClip
=== "content-box";
78 jQuery
.extend( support
, {
79 boxSizingReliable: function() {
81 return boxSizingReliableVal
;
83 pixelBoxStyles: function() {
85 return pixelBoxStylesVal
;
87 pixelPosition: function() {
89 return pixelPositionVal
;
91 reliableMarginLeft: function() {
93 return reliableMarginLeftVal
;
95 scrollboxSize: function() {
97 return scrollboxSizeVal
;