55
66( function ( ) {
77 var pixelPositionVal , boxSizingReliableVal ,
8- // Support: Firefox<29, Android 2.3 (Prefixed box-sizing versions).
9- divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;" +
10- "-moz-box-sizing:content-box;box-sizing:content-box" ,
118 docElem = document . documentElement ,
129 container = document . createElement ( "div" ) ,
1310 div = document . createElement ( "div" ) ;
@@ -20,17 +17,20 @@ define([
2017 div . cloneNode ( true ) . style . backgroundClip = "" ;
2118 support . clearCloneStyle = div . style . backgroundClip === "content-box" ;
2219
23- container . style . cssText = "border:0;width:0;height:0;position:absolute; top:0;left:-9999px;" +
24- "margin-top:1px " ;
20+ container . style . cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px ;" +
21+ "position:absolute " ;
2522 container . appendChild ( div ) ;
2623
2724 // Executing both pixelPosition & boxSizingReliable tests require only one layout
2825 // so they're executed at the same time to save the second computation.
2926 function computePixelPositionAndBoxSizingReliable ( ) {
30- // Support: Firefox<29, Android 2.3 (Prefixed box-sizing versions).
31- div . style . cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
32- "box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;" +
33- "position:absolute;top:1%" ;
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 = "" ;
3434 docElem . appendChild ( container ) ;
3535
3636 var divStyle = window . getComputedStyle ( div , null ) ;
@@ -40,9 +40,10 @@ define([
4040 docElem . removeChild ( container ) ;
4141 }
4242
43- // Use window.getComputedStyle because jsdom on node.js will break without it.
43+ // Support: node.js jsdom
44+ // Don't assume that getComputedStyle is a property of the global object
4445 if ( window . getComputedStyle ) {
45- jQuery . extend ( support , {
46+ jQuery . extend ( support , {
4647 pixelPosition : function ( ) {
4748 // This test is executed only once but we still do memoizing
4849 // since we can use the boxSizingReliable pre-computing.
@@ -64,7 +65,13 @@ define([
6465 // This support function is only executed once so no memoizing is needed.
6566 var ret ,
6667 marginDiv = div . appendChild ( document . createElement ( "div" ) ) ;
67- marginDiv . style . cssText = div . style . cssText = divReset ;
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" ;
6875 marginDiv . style . marginRight = marginDiv . style . width = "0" ;
6976 div . style . width = "1px" ;
7077 docElem . appendChild ( container ) ;
@@ -73,9 +80,6 @@ define([
7380
7481 docElem . removeChild ( container ) ;
7582
76- // Clean up the div for other support tests.
77- div . innerHTML = "" ;
78-
7983 return ret ;
8084 }
8185 } ) ;
0 commit comments