When using getElementDimensions to detect the content-box dimensions of a table or cell, the reported dimensions are incorrect when the table has border-collapse:collapse.
The reason is that MochiKit calculates the content box by subtracting it's border and padding from the offsetWidth/Height. The CSS spec states that in a border-collapsed table the only half the cell border width 'belongs' to a table / table cell, so the 'border width' that is subtracted is actually two times too large.
I don't have write access to the repositories, so I'm submitting a patch file here.
style.diff
Index: Style.js
===================================================================
--- Style.js (revision 1391)
+++ Style.js (working copy)
@@ -363,17 +363,23 @@
originalHeight = elem.offsetHeight || 0;
}
if (contentSize) {
+ // In border-collapsed table, the table / table element's border is shared with it's child or neighbour
+ // In IE, <td>, <tr> etc. elements have display: block
+ var divisor = ((self.getStyle(elem, "display").match(/^table/i) != null
+ || elem.tagName.match(/^(table|thead|tbody|tfoot|col|colgroup|tr|td|td)$/i) != null)
+ && self.getStyle(elem, "borderCollapse") == "collapse") ? 2 : 1;
+
originalWidth -= Math.round(
(parseFloat(self.getStyle(elem, 'paddingLeft')) || 0)
+ (parseFloat(self.getStyle(elem, 'paddingRight')) || 0)
- + (parseFloat(self.getStyle(elem, 'borderLeftWidth')) || 0)
- + (parseFloat(self.getStyle(elem, 'borderRightWidth')) || 0)
+ + (parseFloat(self.getStyle(elem, 'borderLeftWidth')) || 0) / divisor
+ + (parseFloat(self.getStyle(elem, 'borderRightWidth')) || 0) / divisor
);
originalHeight -= Math.round(
(parseFloat(self.getStyle(elem, 'paddingTop')) || 0)
+ (parseFloat(self.getStyle(elem, 'paddingBottom')) || 0)
- + (parseFloat(self.getStyle(elem, 'borderTopWidth')) || 0)
- + (parseFloat(self.getStyle(elem, 'borderBottomWidth')) || 0)
+ + (parseFloat(self.getStyle(elem, 'borderTopWidth')) || 0) / divisor
+ + (parseFloat(self.getStyle(elem, 'borderBottomWidth')) || 0) / divisor
);
}
return new self.Dimensions(originalWidth, originalHeight);