Open Bug 1268280 Opened 5 years ago Updated 2 years ago

clientLeft/clientTop return 0 on window.document.documentElement with actual border


(Core :: DOM: Core & HTML, defect)

47 Branch
Not set





(Reporter: bruno, Unassigned)



(Whiteboard: btpp-followup-2016-05-27)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.59.10 (KHTML, like Gecko) Version/5.1.9 Safari/534.59.10

Steps to reproduce:

Measure window.document.documentElement.clientLeft using:

html {
  border: 10px solid red;

Repro at:

Actual results:

both `clientLeft` and `clientTop` return 0

Expected results:

Per spec, `clientLeft` and `clientTop` should both report the computed with of `border-left-width` and `border-top-height`
Blocks: 111207
Component: Untriaged → DOM
Product: Firefox → Core
Boris, WDYT?
Flags: needinfo?(bzbarsky)
Whiteboard: btpp-followup-2016-05-06
I think there's a spec issue here.  Filed

If the spec stays as-is I guess we can align with it, but the resulting behavior is pretty daft.
Flags: needinfo?(bzbarsky)
(In reply to Boris Zbarsky [:bz] from comment #2)
> I think there's a spec issue here.  Filed

Not sure I follow. It's the same model as CSS top|left conventions using *border-box*. Returning 0 makes it inconsistent with every other elements.

Also I forgot the reference. The bug was highlighted on this jQuery issue:
> It's the same model as CSS top|left conventions using *border-box*

That's not the issue. The issue is that there is literally no relationship in terms of size between the thing that has the border in this case and the thing whose width/height clientWidth/Height return.  They can be totally different sizes and at totally different positions, with either one being larger or smaller, depending on the exact style rules.

Maybe that's OK, but seems pretty weird to me if the offset* properties are supposed to be related to each other in any way.
No traffic on the spec bug yet.
Whiteboard: btpp-followup-2016-05-06 → btpp-followup-2016-05-27
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.