Open Bug 342042 Opened 18 years ago Updated 2 years ago

offsetHeight of element with floating child is incorrectly zero

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
Linux
defect

Tracking

()

People

(Reporter: tiresias, Unassigned)

Details

(Whiteboard: DUPEME)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4
Build Identifier: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4

The offsetHeight property of an element is incorrectly zero when its child of non-zero height is floated.

eg:
<div id="container">
  <div id="content" style="float:left;">
    Lorem ipsum dolor sit amet
  </div>
</div>

offsetHeight is the correct height of the parent div when the child div is not floated.

I am attaching a simple test case.

Reproducible: Always
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9a1) Gecko/20060620 Minefield/3.0a1 - Build ID: 0000000000
Confirmed.
For that testcase it was 114 when I removed the float, but 0 with it in place.
Status: UNCONFIRMED → NEW
Ever confirmed: true
The actual height of the outer div in this case is in fact 0.  This bug is a duplicate of the various other "offsetHeight returns what the layout looks like, not what it would look like in IE" bugs.
Whiteboard: DUPEME
I use Firefox on Linux. I have no clue how IE treats offsetHeight.

It is surprising to me that the height of floated elements should by themselves have zero bearing on the parent's offsetHeight, while they certainly do affect offsetHeight indirectly in the presence of non-floated elements.

According to the Moz developer docs*, offsetHeight is an IE-original property, "not part of any W3C specification or technical recommendation." If, as your comment seems to suggest, IE does include the height of floated objects in the calculation of the parent's offSetHeight, and there is no spec dictating an alternate behavior, then in this case what reason is there to deviate from that?

*  http://developer.mozilla.org/en/docs/DOM:element.offsetHeight
Assignee: general → nobody
QA Contact: ian → general
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: