44] , function ( jQuery , support ) {
55
66( function ( ) {
7- // Minified: var b,c,d,e,f,g, h,i
8- var div , style , a , pixelPositionVal , boxSizingReliableVal ,
7+ var div , container , style , a , pixelPositionVal , boxSizingReliableVal , pixelMarginRightVal ,
98 reliableHiddenOffsetsVal , reliableMarginRightVal ;
109
1110 // Setup
@@ -33,40 +32,55 @@ define([
3332 div . cloneNode ( true ) . style . backgroundClip = "" ;
3433 support . clearCloneStyle = div . style . backgroundClip === "content-box" ;
3534
35+ container = document . createElement ( "div" ) ;
36+ container . style . cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
37+ "padding:0;margin-top:1px;position:absolute" ;
38+ div . innerHTML = "" ;
39+ container . appendChild ( div ) ;
40+
3641 jQuery . extend ( support , {
3742 reliableHiddenOffsets : function ( ) {
38- if ( reliableHiddenOffsetsVal == null ) {
43+ if ( pixelPositionVal == null ) {
3944 computeStyleTests ( ) ;
4045 }
4146 return reliableHiddenOffsetsVal ;
4247 } ,
4348
4449 boxSizingReliable : function ( ) {
45- if ( boxSizingReliableVal == null ) {
50+ // We're checking for pixelPositionVal here instead of boxSizingReliableVal
51+ // since that compresses better and they're computed together anyway.
52+ if ( pixelPositionVal == null ) {
4653 computeStyleTests ( ) ;
4754 }
4855 return boxSizingReliableVal ;
4956 } ,
5057
58+ pixelMarginRight : function ( ) {
59+ // Support: Android 4.0-4.3
60+ if ( pixelPositionVal == null ) {
61+ computeStyleTests ( ) ;
62+ }
63+ return pixelMarginRightVal ;
64+ } ,
65+
5166 pixelPosition : function ( ) {
5267 if ( pixelPositionVal == null ) {
5368 computeStyleTests ( ) ;
5469 }
5570 return pixelPositionVal ;
5671 } ,
5772
58- // Support: Android 2.3
5973 reliableMarginRight : function ( ) {
60- if ( reliableMarginRightVal == null ) {
74+ // Support: Android 2.3
75+ if ( pixelPositionVal == null ) {
6176 computeStyleTests ( ) ;
6277 }
6378 return reliableMarginRightVal ;
6479 }
6580 } ) ;
6681
6782 function computeStyleTests ( ) {
68- // Minified: var b,c,d,j
69- var div , container , contents ,
83+ var contents , divStyle ,
7084 body = document . body ;
7185
7286 if ( ! body || ! body . style ) {
@@ -75,17 +89,16 @@ define([
7589 }
7690
7791 // Setup
78- div = document . createElement ( "div" ) ;
79- container = document . createElement ( "div" ) ;
80- container . style . cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px" ;
81- body . appendChild ( container ) . appendChild ( div ) ;
92+ body . appendChild ( container ) ;
8293
8394 div . style . cssText =
8495 // Support: Android 2.3
8596 // Vendor-prefix box-sizing
8697 "-webkit-box-sizing:border-box;box-sizing:border-box;" +
87- "display:block;margin-top:1%;top:1%;" +
88- "border:1px;padding:1px;width:4px;position:absolute" ;
98+ "position:absolute;display:block;" +
99+ "margin:0;margin-top:1%;margin-right:50%;" +
100+ "border:1px;padding:1px;" +
101+ "top:1%;height:4px;width:50%" ;
89102
90103 // Support: IE<9
91104 // Assume reasonable values in the absence of getComputedStyle
@@ -94,9 +107,10 @@ define([
94107
95108 // Check for getComputedStyle so that this code is not run in IE<9.
96109 if ( window . getComputedStyle ) {
97- pixelPositionVal = ( window . getComputedStyle ( div , null ) || { } ) . top !== "1%" ;
98- boxSizingReliableVal =
99- ( window . getComputedStyle ( div , null ) || { width : "4px" } ) . width === "4px" ;
110+ divStyle = window . getComputedStyle ( div , null ) ;
111+ pixelPositionVal = ( divStyle || { } ) . top !== "1%" ;
112+ boxSizingReliableVal = ( divStyle || { height : "4px" } ) . height === "4px" ;
113+ pixelMarginRightVal = ( divStyle || { marginRight : "4px" } ) . marginRight === "4px" ;
100114
101115 // Support: Android 2.3
102116 // Div with explicit width and no margin-right incorrectly
@@ -136,6 +150,7 @@ define([
136150 reliableHiddenOffsetsVal = contents [ 0 ] . offsetHeight === 0 ;
137151 }
138152
153+ // Teardown
139154 body . removeChild ( container ) ;
140155 }
141156
0 commit comments