X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcss.js;h=a6e2bb6143613a6d187a58c7f803d7beacff5afe;hb=a8fa5f2ec1030bceb9a65d0237f0c92ae4e014dd;hp=0998657b047f94ed8075699c60bc9d00374bce48;hpb=9d1bfeb7ffe63b5a7488929b7be847bc1a00f6a6;p=jquery.git diff --git a/src/css.js b/src/css.js index 0998657..a6e2bb6 100644 --- a/src/css.js +++ b/src/css.js @@ -12,9 +12,6 @@ var ralpha = /alpha\([^)]*\)/i, cssHeight = [ "Top", "Bottom" ], curCSS, - // cache check for defaultView.getComputedStyle - getComputedStyle = document.defaultView && document.defaultView.getComputedStyle, - fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; @@ -173,13 +170,18 @@ jQuery.each(["height", "width"], function( i, name ) { val = curCSS( elem, name, name ); if ( val != null ) { - return val; + // Should return "auto" instead of 0, use 0 for + // temporary backwards-compat + return val === "" || val === "auto" ? "0px" : val; } } if ( val < 0 || val == null ) { val = elem.style[ name ]; - return val === "" ? "auto" : val; + + // Should return "auto" instead of 0, use 0 for + // temporary backwards-compat + return val === "" || val === "auto" ? "0px" : val; } return typeof val === "string" ? val : val + "px"; @@ -231,7 +233,7 @@ if ( !jQuery.support.opacity ) { }; } -if ( getComputedStyle ) { +if ( document.defaultView && document.defaultView.getComputedStyle ) { curCSS = function( elem, newName, name ) { var ret, defaultView, computedStyle; @@ -248,12 +250,13 @@ if ( getComputedStyle ) { } } - return ret === "" ? "auto" : ret; + return ret; }; - } else if ( document.documentElement.currentStyle ) { curCSS = function( elem, name ) { - var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style; + var left, rsLeft, + ret = elem.currentStyle && elem.currentStyle[ name ], + style = elem.style; // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 @@ -305,7 +308,8 @@ function getWH( elem, name, extra ) { if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.hidden = function( elem ) { - var width = elem.offsetWidth, height = elem.offsetHeight; + var width = elem.offsetWidth, + height = elem.offsetHeight; return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none"); };