[csswg-drafts] [cssom-view] Definition of clientLeft and clientTop doesn't make sense for the document scrolling element. (#5363)

emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] Definition of clientLeft and clientTop doesn't make sense for the document scrolling element. ==
https://drafts.csswg.org/cssom-view/#dom-element-clienttop says:

> Return the computed value of the border-top-width property plus the height of any scrollbar rendered between the top padding edge and the top border edge, ignoring any transforms that apply to the element and its ancestors.

Note how there's no special-case for the root. But `clientWidth` and `clientHeight` have a special case for the root element:

> If the element is the root element and the element’s node document is not in quirks mode, or if the element is the HTML body element and the element’s node document is in quirks mode, return the viewport width excluding the size of a rendered scroll bar (if any).

So surely enough if you follow the spec to the letter, for a test-case like this:

```html
<!doctype html>
<style>
  :root { margin: 100px; border: 10px solid; }
</style>
```

The rect you get doesn't make sense. Gecko does the sensible thing, I think, which is that in this case the x and y are zero.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5363 using your GitHub account

Received on Monday, 27 July 2020 09:57:33 UTC