clientHeight and scrollHeight are different
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: jeanalain.re, Unassigned)
Details
(Keywords: testcase, Whiteboard: dom-triaged)
Attachments
(3 files, 1 obsolete file)
Comment 2•10 years ago
|
||
| Reporter | ||
Comment 3•10 years ago
|
||
| Reporter | ||
Comment 4•10 years ago
|
||
| Assignee | ||
Updated•7 years ago
|
Updated•6 years ago
|
I've encountered the same bug, but I'm unable to isolate it. It doesn't happen in Chrome. Confirmed by several people (same result on their end: broken in FF, works in Chrome).
With this bug present, I'm unable to reliably detect if element is scrollable, which is breaking my code atm.
I've encountered the bug on this page: https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md
The element in question is document.querySelector('.repository-content .Box.mt-3.position-relative').
You can see that the element is not scrollable (scrollTop can't be set above 0), yet the scrollHeight for some reason equals offsetHeight and not clientHeight.
I'm aware that the provided link above might be temporary until github touches their layout styles, but since I'm unable to isolate, here is at a least screenshot of the element's layout and computed styles.
It seems the issue is related to negative margins of container children. If container has border, and children have negative top/bottom margins, it produces weird values. But that doesn't explain why they are not consistent with chrome.
Updated•4 years ago
|
Description
•