offsetHeight/offsetWidth of dynamically written Elements 0

VERIFIED DUPLICATE of bug 44545

Status

()

Core
DOM
P3
normal
VERIFIED DUPLICATE of bug 44545
18 years ago
18 years ago

People

(Reporter: Wolfgang Schwarz, Assigned: jst)

Tracking

Trunk
x86
Windows 98
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

18 years ago
After creating an element with document.write, its offsetHeight and offsetLeft 
often are zero instead of the correct value.

Steps to Reproduce:

document.write("<div id='blub'>blub</div>");
alert(document.getElementById("blub").offsetHeight)

Actual Results:  "0"
Expected Results:  something like: "20"	


It works if the element is created using DOM methods 
(document.body.appendChild...).

This bug may be related to
http://bugzilla.mozilla.org/show_bug.cgi?id=44545.

I think this should be fixed because 

1. offsetHeight is certainly the most used method to get the computed height of 
an element and shouldn't fail.

2. I will use it in a javascript book that will be published soon, so if the bug 
remains, thousands of people ;) will notice it.

Comment 1

18 years ago
Marking DUPLICATE of bug#44545.  Will add woschwarz@gmx.de to cc list of 44545.

*** This bug has been marked as a duplicate of 44545 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → DUPLICATE

Comment 2

18 years ago
Verifying  as a duplicate of 44545 
'document.body.offset* returns 0.'
Status: RESOLVED → VERIFIED
Component: DOM Level 2 → DOM Other
Component: DOM Other → DOM Level 1
You need to log in before you can comment on or make changes to this bug.