@@ -12,8 +12,8 @@ var ralpha = /alpha\([^)]*\)/i,
12
12
cssHeight = [ "Top" , "Bottom" ] ,
13
13
curCSS ,
14
14
15
- // cache check for defaultView. getComputedStyle
16
- getComputedStyle = document . defaultView && document . defaultView . getComputedStyle ,
15
+ getComputedStyle ,
16
+ currentStyle ,
17
17
18
18
fcamelCase = function ( all , letter ) {
19
19
return letter . toUpperCase ( ) ;
@@ -172,6 +172,10 @@ jQuery.each(["height", "width"], function( i, name ) {
172
172
if ( val <= 0 ) {
173
173
val = curCSS ( elem , name , name ) ;
174
174
175
+ if ( val === "0px" && currentStyle ) {
176
+ val = currentStyle ( elem , name , name ) ;
177
+ }
178
+
175
179
if ( val != null ) {
176
180
return val ;
177
181
}
@@ -231,8 +235,8 @@ if ( !jQuery.support.opacity ) {
231
235
} ;
232
236
}
233
237
234
- if ( getComputedStyle ) {
235
- curCSS = function ( elem , newName , name ) {
238
+ if ( document . defaultView && document . defaultView . getComputedStyle ) {
239
+ getComputedStyle = function ( elem , newName , name ) {
236
240
var ret , defaultView , computedStyle ;
237
241
238
242
name = name . replace ( rupper , "-$1" ) . toLowerCase ( ) ;
@@ -250,9 +254,10 @@ if ( getComputedStyle ) {
250
254
251
255
return ret === "" ? "auto" : ret ;
252
256
} ;
257
+ }
253
258
254
- } else if ( document . documentElement . currentStyle ) {
255
- curCSS = function ( elem , name ) {
259
+ if ( document . documentElement . currentStyle ) {
260
+ currentStyle = function ( elem , name ) {
256
261
var left , rsLeft , ret = elem . currentStyle && elem . currentStyle [ name ] , style = elem . style ;
257
262
258
263
// From the awesome hack by Dean Edwards
@@ -279,6 +284,8 @@ if ( getComputedStyle ) {
279
284
} ;
280
285
}
281
286
287
+ curCSS = getComputedStyle || currentStyle ;
288
+
282
289
function getWH ( elem , name , extra ) {
283
290
var which = name === "width" ? cssWidth : cssHeight ,
284
291
val = name === "width" ? elem . offsetWidth : elem . offsetHeight ;
0 commit comments