Closed
Bug 297284
Opened 20 years ago
Closed 19 years ago
JS clientHeight not correctly detected
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: jab_creations, Unassigned)
References
()
Details
Attachments
(1 file)
|
397 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050525 Firefox/1.0+ Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050525 Firefox/1.0+ The url example shows that FF can detect the clientWidth but not height. The first promt is clientwidth... second is clientwidth -20 third is clientheight fourth is clientheight -20 Reproducible: Always Actual Results: clientHeight is detected as 0 on third prompt and -20 on fourth prompt. Expected Results: This script works correctly in IE 6 (XP sp1) and Opera 8. Various browsers with differing toolbars will change the height obviously. I am curious if there is another way to currently detect the height of the client rendering area? I use clientHeight on my site and have for some time. From my perspective clientHeight is correctly detected and used, it just does not seem to be correctly rendered as a numerical value perhaps?
Comment 1•20 years ago
|
||
Comment 2•20 years ago
|
||
The <body> has a height of 0px, so the clientHeight (which is equivalent to .offsetHeight afaik) is also 0px. When you put textual content in the body, you'll see the clientHeight property grows higher. If you want the document height in Mozilla, you can use window.innerHeight + window.scrollMaxY.
Updated•20 years ago
|
Assignee: nobody → general
Component: General → DOM: Mozilla Extensions
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.0 Branch
| Reporter | ||
Comment 3•20 years ago
|
||
Would someone be kind enough to explain the difference between window.innerHeight and document.body.clientHeight? What is the intended purpose of each? Why should Opera, IE, and Gecko all recognize clientWidth but not clientHeight? I am sure there must be some standards as well. Who sets the standards for Javascript?
Comment 4•20 years ago
|
||
window.innerHeight is the height of the viewport, see: http://www.mozilla.org/docs/dom/domref/dom_window_ref27.html document.body.clientHeight is the height of the body element. offsetHeight=height+border-bottom-width+border-top-width, clientHeight = height, see: http://www.mozilla.org/docs/dom/domref/dom_el_ref18.html http://www.mozilla.org/docs/dom/domref/clientHeight.html See also bug 260498, where a similar discussion took place (but there's some more info there also).
Comment 5•19 years ago
|
||
*** Bug 304142 has been marked as a duplicate of this bug. ***
Comment 6•19 years ago
|
||
Martijn is correct here: the default width will be the viewport for the block element of body, but it's default height is 0. -->INVALID
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Updated•12 years ago
|
Component: DOM: Mozilla Extensions → DOM
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•