X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcss.js;h=30cecf39d42f54c3a18d9967600a7098b4e35cc9;hb=974b5aeab7a3788ff5fb9db87b9567784e0249fc;hp=d0e55db0f4ed1b040a06e722e2374f8c01d51f10;hpb=b0dcc1746f58f5aca17a12794dd928c0deaaa6a0;p=jquery.git diff --git a/src/css.js b/src/css.js index d0e55db..30cecf3 100644 --- a/src/css.js +++ b/src/css.js @@ -169,7 +169,19 @@ jQuery.each(["height", "width"], function( i, name ) { }); } - return val + "px"; + if ( val <= 0 ) { + val = curCSS( elem, name, name ); + + if ( val != null ) { + return val === "auto" ? "" : val; + } + } + + if ( val < 0 || val == null ) { + return elem.style[ name ]; + } + + return typeof val === "string" ? val : val + "px"; } }, @@ -230,6 +242,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;