@@ -8,7 +8,6 @@ jQuery.support = (function() {
88 select ,
99 opt ,
1010 input ,
11- marginDiv ,
1211 fragment ,
1312 tds ,
1413 events ,
@@ -143,23 +142,6 @@ jQuery.support = (function() {
143142 fragment . removeChild ( input ) ;
144143 fragment . appendChild ( div ) ;
145144
146- div . innerHTML = "" ;
147-
148- // Check if div with explicit width and no margin-right incorrectly
149- // gets computed margin-right based on width of container. For more
150- // info see bug #3333
151- // Fails in WebKit before Feb 2011 nightlies
152- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
153- if ( window . getComputedStyle ) {
154- marginDiv = document . createElement ( "div" ) ;
155- marginDiv . style . width = "0" ;
156- marginDiv . style . marginRight = "0" ;
157- div . style . width = "2px" ;
158- div . appendChild ( marginDiv ) ;
159- support . reliableMarginRight =
160- ( parseInt ( ( window . getComputedStyle ( marginDiv , null ) || { marginRight : 0 } ) . marginRight , 10 ) || 0 ) === 0 ;
161- }
162-
163145 // Technique from Juriy Zaytsev
164146 // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
165147 // We only care about the case where non-standard event systems
@@ -185,12 +167,12 @@ jQuery.support = (function() {
185167 fragment . removeChild ( div ) ;
186168
187169 // Null elements to avoid leaks in IE
188- fragment = select = opt = marginDiv = div = input = null ;
170+ fragment = select = opt = div = input = null ;
189171
190172 // Run tests that need a body at doc ready
191173 jQuery ( function ( ) {
192174 var container , outer , inner , table , td , offsetSupport ,
193- conMarginTop , ptlm , vb , style , html ,
175+ marginDiv , conMarginTop , ptlm , vb , style , html ,
194176 body = document . getElementsByTagName ( "body" ) [ 0 ] ;
195177
196178 if ( ! body ) {
@@ -233,6 +215,22 @@ jQuery.support = (function() {
233215 // (IE <= 8 fail this test)
234216 support . reliableHiddenOffsets = isSupported && ( tds [ 0 ] . offsetHeight === 0 ) ;
235217
218+ // Check if div with explicit width and no margin-right incorrectly
219+ // gets computed margin-right based on width of container. For more
220+ // info see bug #3333
221+ // Fails in WebKit before Feb 2011 nightlies
222+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
223+ if ( window . getComputedStyle ) {
224+ div . innerHTML = "" ;
225+ marginDiv = document . createElement ( "div" ) ;
226+ marginDiv . style . width = "0" ;
227+ marginDiv . style . marginRight = "0" ;
228+ div . style . width = "2px" ;
229+ div . appendChild ( marginDiv ) ;
230+ support . reliableMarginRight =
231+ ( parseInt ( ( window . getComputedStyle ( marginDiv , null ) || { marginRight : 0 } ) . marginRight , 10 ) || 0 ) === 0 ;
232+ }
233+
236234 // Figure out if the W3C box model works as expected
237235 div . innerHTML = "" ;
238236 div . style . width = div . style . paddingLeft = "1px" ;
@@ -289,7 +287,7 @@ jQuery.support = (function() {
289287 }
290288
291289 body . removeChild ( container ) ;
292- div = container = null ;
290+ marginDiv = div = container = null ;
293291
294292 jQuery . extend ( support , offsetSupport ) ;
295293 } ) ;
0 commit comments