Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cssom-view] Define rounding for clientWidth & friends #9866

Open
Loirooriol opened this issue Jan 26, 2024 · 0 comments
Open

[cssom-view] Define rounding for clientWidth & friends #9866

Loirooriol opened this issue Jan 26, 2024 · 0 comments

Comments

@Loirooriol
Copy link
Contributor

Loirooriol commented Jan 26, 2024

<div id="target" style="width: 9.9px"></div>
Gecko Blink & WebKit Servo
target.getBoundingClientRect().width 9.899993896484375 9.890625 9.9
target.clientWidth 10 10  9   10 

The definition of clientWidth is

https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface

readonly attribute long clientWidth;

https://drafts.csswg.org/cssom-view/#dom-element-clientwidth

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.

It doesn't mention any kind of rounding, I'm assuming this is handled by https://webidl.spec.whatwg.org/#js-long
If I'm getting it right, it's supposed to just truncate the number, like Servo used to do, but that's not what the other browser are doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant