W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2019

[csswg-drafts] [cssom-view] [css-tables] should table.clientWidth include borders? (#4245)

From: davidsgrogan via GitHub <sysbot+gh@w3.org>
Date: Tue, 27 Aug 2019 18:14:23 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-485958092-1566929661-sysbot+gh@w3.org>
davidsgrogan has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] [css-tables] should table.clientWidth include borders? ==
Firefox includes table borders in clientWidth. Blink doesn't. I suspect Firefox adheres closer to the spec (though see below), but is it intended that `table.clientWidth` and `table.offsetWidth` always return the same value?

Given that the border properties live on (and are rendered around) the table grid box, not the table wrapper box, the pertinent question is: does clientWidth operate on table wrapper box or table grid box?

The text from [clientWidth](https://drafts.csswg.org/cssom-view/#dom-element-clientwidth) :

1. If the element has no associated CSS layout box or if _the_ CSS layout box is inline, return zero.  
2. N/A
3. Return the width of _the_ padding edge excluding the width of any rendered scrollbar between the padding edge and the border edge, ignoring any transforms that apply to the element and its ancestors

I assume that when the steps above say _the_, they refer to the element's principal box, but could I get clarification on that? Should they, in this case, refer to the table grid box? If these steps do refer to the principal box, then FF behavior is correct but seemingly unfortunate in that offsetWidth and clientWidth are the same for tables. Which brings back to the original question: is it intended that table.clientWidth and table.offsetWidth are the same?

More relevant research:
The [bug](https://bugzilla.mozilla.org/show_bug.cgi?id=820891) where Gecko switched to using the wrapper box for client* properties cites the definition of offset* as justification, which [does say](https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetwidth) that offset* operates on the wrapper box. But the relevant part of that definition—"Return the border edge width of the _first_ CSS layout box"—only appears for the offset* properties, not the client* properties.

Further, the offset* and client* properties are extensions of different interfaces: offset* is on HTMLElement. client* is on Element. Is that relevant to why offset* includes _first_ CSS layout box but client* doesn't?

This stems from a [chrome bug report. ](https://crbug.com/978019)

/cc @FremyCompany  @fantasai (as she was instrumental in the current definition of table wrapper box)

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4245 using your GitHub account
Received on Tuesday, 27 August 2019 18:14:24 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:13 UTC