@@ -8,7 +8,6 @@ jQuery.support = (function() {
8
8
select ,
9
9
opt ,
10
10
input ,
11
- marginDiv ,
12
11
fragment ,
13
12
tds ,
14
13
events ,
@@ -143,23 +142,6 @@ jQuery.support = (function() {
143
142
fragment . removeChild ( input ) ;
144
143
fragment . appendChild ( div ) ;
145
144
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
-
163
145
// Technique from Juriy Zaytsev
164
146
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
165
147
// We only care about the case where non-standard event systems
@@ -185,12 +167,12 @@ jQuery.support = (function() {
185
167
fragment . removeChild ( div ) ;
186
168
187
169
// Null elements to avoid leaks in IE
188
- fragment = select = opt = marginDiv = div = input = null ;
170
+ fragment = select = opt = div = input = null ;
189
171
190
172
// Run tests that need a body at doc ready
191
173
jQuery ( function ( ) {
192
174
var container , outer , inner , table , td , offsetSupport ,
193
- conMarginTop , ptlm , vb , style , html ,
175
+ marginDiv , conMarginTop , ptlm , vb , style , html ,
194
176
body = document . getElementsByTagName ( "body" ) [ 0 ] ;
195
177
196
178
if ( ! body ) {
@@ -233,6 +215,22 @@ jQuery.support = (function() {
233
215
// (IE <= 8 fail this test)
234
216
support . reliableHiddenOffsets = isSupported && ( tds [ 0 ] . offsetHeight === 0 ) ;
235
217
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
+
236
234
// Figure out if the W3C box model works as expected
237
235
div . innerHTML = "" ;
238
236
div . style . width = div . style . paddingLeft = "1px" ;
@@ -289,7 +287,7 @@ jQuery.support = (function() {
289
287
}
290
288
291
289
body . removeChild ( container ) ;
292
- div = container = null ;
290
+ marginDiv = div = container = null ;
293
291
294
292
jQuery . extend ( support , offsetSupport ) ;
295
293
} ) ;
0 commit comments