Closed
Bug 576976
Opened 14 years ago
Closed 6 years ago
Element.scrollHeight: DOES NOT include padding for text area's, DOES include border for div's?
Categories
(Core :: Layout: Form Controls, defect)
Core
Layout: Form Controls
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: u283834, Unassigned)
References
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 The property element.scrollHeight does not include padding of a text area, but for a div it includes both padding AND border. This is not according to the documentation at https://developer.mozilla.org/en/DOM/element.scrollHeight Reproducible: Always Steps to Reproduce: 1. Use a text area with padding. 2. Compute the scroll height. Actual Results: Scroll height = height, but not including padding. Expected Results: Scroll height should be height including padding. For a div, the situation is again different: border seems to be included there as well.
Click the text area / div to view computed scroll height values.
Comment 2•14 years ago
|
||
I can see the same behaviour. scrollHeight includes height + padding + border. clientHeight includes heigth + padding. So, clientHeight is not the same as scrollHeight for non scrollable elements. Opera behaves the same way as firefox, while webkit behaves the same way as described in the documentation. I'll attach another testcase
Comment 3•14 years ago
|
||
Updated•13 years ago
|
Version: unspecified → 3.6 Branch
This behaviour also makes it impossible to ascertain whether or not overflow has occurred in a div, because even an empty div with a fixed height of, say, 123px will report a clientHeight of 123px but a scrollHeight of 123 + border-top + border-bottom, which is the only way to test whether or not overflow has occurred. problem touches on what was filed at http://code.google.com/p/chromium/issues/detail?id=74999
Comment 6•12 years ago
|
||
Boris, could that be related to bug 157846?
Severity: major → normal
Status: UNCONFIRMED → NEW
Component: General → Layout: Form Controls
Ever confirmed: true
OS: Windows 7 → All
Product: Firefox → Core
QA Contact: general → layout.form-controls
Hardware: x86 → All
Version: 3.6 Branch → Trunk
Comment 8•12 years ago
|
||
Seems plausible, yes. We really need a spec for form controls....
Comment 9•12 years ago
|
||
See related: bug 735646. It has patches that change scrollHeight to not include the border. That should fix half of this bug (the div half, not the textarea half).
Comment 10•12 years ago
|
||
Oops, I meant bug 755971. That has landed on inbound now, but I'll leave this open since I'm not sure if there are other unresolved issues here.
Comment 11•7 years ago
|
||
does this bug need to still be open after 5 years of nothing happening? =)
Comment 12•7 years ago
|
||
Yes, because we still need to get a spec written for this stuff.
Flags: needinfo?(zcorpan)
Comment 13•7 years ago
|
||
Hm, that sounds like it would be more valuable to start a new bug for working on fleshing out a spec, with a bug title appropriate to that work, while closing (or blocking) this very specific bug that isn't going to get "fixed" until an adopted spec exists.
Comment 14•7 years ago
|
||
The spec bug needs to go in <https://github.com/w3c/csswg-drafts/labels/cssom-view-1>. As for this bug, I'm not sure what we gain by closing it. At least this way we're aware there's a problem that needs resolving here, instead of sweeping it under the rug.
Updated•6 years ago
|
Flags: needinfo?(zcorpan) → needinfo?(emilio)
Comment 15•6 years ago
|
||
I'm technically not an editor of cssom-view, but I can take a look and help out.
Comment 16•6 years ago
|
||
That being said this bug is working for me. It's just that <textarea> uses box-sizing: border-box. This works the same way in WebKit and Blink too, afaict.
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(emilio)
Resolution: --- → WORKSFORME
Comment 17•6 years ago
|
||
Relevant spec is https://drafts.csswg.org/cssom-view/#scrolling-area, which looks roughly ok to me, though need to look closer.
You need to log in
before you can comment on or make changes to this bug.
Description
•