Closed Bug 296590 Opened 20 years ago Closed 19 years ago

Incorrect offsetHeight for element?

Categories

(Core :: Layout, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: srt, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

<div id=contentright> on page http://www.talkingpointsmemo.com/ reports an
offsetHeight of 18px.  You can verify this in the DOM Inspector.  This seems
incorrect to me, since it contains e.g., a table with offsetHeight of 123. 
offsetWidth works as expected (it's equal to the widest child element).

I apologize if I'm simply misunderstanding something about DOM.  If so, is there
a way to reliably get the actual height of the div?  (E.g., the sum of the
heights of all its descendants?)

Reproducible: Always
Here's another odd case: On http://www.coolhunting.com/index.php, body returns
offsetHeight and offsetWidth return 0 and 0.  Surely that can't be right?
Further investigation shows that in all these odd cases the web site is using
CSS position:absolute or similar on some or all the elements that are within the
elements that are mis-reporting their offsetHeight.  It's hard to find a
definition anywhere of how offsetHeight is calculated, but I'm guessing that if
an element is absolutely positioned its ignored for the calculation. 

Gruesome.

Anyway, if that's the case please let me know and I guess mark this resolved...
Yeah, offsetHeight should not include abs pos kids.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.