- if ($.getCSS(e,"display") != 'none')
- return p == 'height' ?
- e.offsetHeight || parseInt(e.style.height) :
- e.offsetWidth || parseInt(e.style.width);
- var els = e.style;
- var ov = els.visibility;
- var op = els.position;
- var od = els.display;
- els.visibility = 'hidden';
- els.position = 'absolute';
- els.display = '';
- var oHeight = e.clientHeight || parseInt(e.style.height);
- var oWidth = e.clientWidth || parseInt(e.style.width);
- els.display = od;
- els.position = op;
- els.visibility = ov;
- return p == 'height' ? oHeight : oWidth;
- }
-
- if (e.style[p])
- return e.style[p];
- else if (e.currentStyle)
- return e.currentStyle[p];
- else if (document.defaultView && document.defaultView.getComputedStyle) {
- p = p.replace(/([A-Z])/g,"-$1");
- p = p.toLowerCase();
- var s = document.defaultView.getComputedStyle(e,"");
- var r = s ? s.getPropertyValue(p) : p;
+
+ // Handle extra width/height provided by the W3C box model
+ var ph = (!$.boxModel ? 0 :
+ parseInt($.css(e,"paddingTop")) + parseInt($.css(e,"paddingBottom")) +
+ parseInt($.css(e,"borderTopWidth")) + parseInt($.css(e,"borderBottomWidth"))) || 0;
+
+ var pw = (!$.boxModel ? 0 :
+ parseInt($.css(e,"paddingLeft")) + parseInt($.css(e,"paddingRight")) +
+ parseInt($.css(e,"borderLeftWidth")) + parseInt($.css(e,"borderRightWidth"))) || 0;
+
+ var oHeight, oWidth;
+
+ if ($.css(e,"display") != 'none') {
+ oHeight = e.offsetHeight || parseInt(e.style.height,10) || 0;
+ oWidth = e.offsetWidth || parseInt(e.style.width,10) || 0;
+ } else {
+ var els = e.style;
+ var ov = els.visibility;
+ var op = els.position;
+ var od = els.display;
+ els.visibility = 'hidden';
+ els.position = 'absolute';
+ els.display = '';
+ oHeight = e.clientHeight || parseInt(e.style.height,10);
+ oWidth = e.clientWidth || parseInt(e.style.width,10);
+ els.display = od;
+ els.position = op;
+ els.visibility = ov;
+ }
+
+ return p == 'height' ?
+ (oHeight - ph < 0 ? 0 : oHeight - ph) :
+ (oWidth - pw < 0 ? 0 : oWidth - pw);
+ }
+
+ if (e.style[p]) {
+ return e.style[p];
+ } else if (e.currentStyle) {
+ return e.currentStyle[p];
+ } else if (document.defaultView && document.defaultView.getComputedStyle) {
+ p = p.replace(/([A-Z])/g,"-$1");
+ p = p.toLowerCase();
+ var s = document.defaultView.getComputedStyle(e,"");
+ var r = s ? s.getPropertyValue(p) : p;