Closed Bug 48956 Opened 24 years ago Closed 24 years ago

offsetHeight/offsetWidth of dynamically written Elements 0

Categories

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

x86
Windows 98
defect

Tracking

()

VERIFIED DUPLICATE of bug 44545

People

(Reporter: wo, Assigned: jst)

Details

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.
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
Closed: 24 years ago
Resolution: --- → DUPLICATE
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
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.