E47B [cssom-view] [css-tables] should table.clientWidth include borders? · Issue #4245 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

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

@davidsgrogan

Description

@davidsgrogan

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 apply to 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 :

  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 where Gecko switched to using the wrapper box for client* properties cites the definition of offset* as justification, which does say 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.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0