Make sure that height/width getters work on hidden inputs and disconnected elements...
[jquery.git] / src / css.js
index d0e55db..f2165f9 100644 (file)
@@ -169,6 +169,10 @@ jQuery.each(["height", "width"], function( i, name ) {
                                        });
                                }
 
+                               if ( val < 0 || val === 0 && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
+                                       return elem.style[ name ] || "0px";
+                               }
+
                                return val + "px";
                        }
                },
@@ -230,6 +234,9 @@ if ( getComputedStyle ) {
 
                if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
                        ret = computedStyle.getPropertyValue( name );
+                       if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
+                               ret = jQuery.style( elem, name );
+                       }
                }
 
                return ret;