cssHeight = [ "Top", "Bottom" ],
curCSS,
- // cache check for defaultView.getComputedStyle
- getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
-
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
});
}
- return val + "px";
+ if ( val <= 0 ) {
+ val = curCSS( elem, name, name );
+
+ if ( val != null ) {
+ // 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 ];
+
+ // 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";
}
},
};
}
-if ( getComputedStyle ) {
+if ( document.defaultView && document.defaultView.getComputedStyle ) {
curCSS = function( elem, newName, name ) {
var ret, defaultView, computedStyle;
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
elem.runtimeStyle.left = rsLeft;
}
- return ret;
+ return ret === "" ? "auto" : ret;
};
}
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");
};