Closed Bug 43741 Opened 24 years ago Closed 24 years ago

document.open() overwrites in Mozilla, inserts in NS4 and IE5

Categories

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

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: jag+mozbugs, Assigned: jst)

References

()

Details

(Whiteboard: [nsbeta3+][PDTP2][Have fix])

Attachments

(2 files)

Windows 95, build ID 2000062408
Linux, build ID 2000062408

DOM 1 and 2 specs both state for open():
"Open a document stream for writing. If a document exists in the target, this 
method clears it."

However, both IE 5 and NS 4 (both Win95 and linux) just insert into the document 
if the target is the current document.

I'll attach a reduced test case, which displays "foo bla bar" in NS4/IE5 and 
"bla" in Moz.
This is a backwards compatibility issue, should be fixed for beta3. Nominating
for nsbeta3.
Status: NEW → ASSIGNED
Priority: P3 → P2
Target Milestone: --- → M18
*** Bug 44765 has been marked as a duplicate of this bug. ***
another sample is http://www.dagbladet.no
Peter's test case (and initial bug report) are actually misleading!  The 
behavior of document.open() varies depending on whether or not the page has 
been loaded.
- When the page is first loaded, open() has no effect - write()s are appended 
to the document (as Peter's test shows).  This is the proper behavior when the 
document is loading!
- Once the page is loaded, open() should clear the document (click "doWrite()" 
in my test case to see an example of this).  This is how it is documented in 
the DOM2 spec (pg 53-54) *and* is how IE4/5 and NS4.X behave.

The bug is actually that NS6, once the document is loaded, doesn't clear the 
document when open() is called.
I certainly didn't mean to be misleading, thank you for clarifying current 
behaviour and attaching the new testcase.

>The bug is actually that NS6, once the document is loaded, doesn't clear the
>document when open() is called.

Can you please specify on which platforms and which builds document.open() 
doesn't clear the document once it's loaded? NS6 is such a general name and I 
certainly hope you tested with something a bit more recent than NS6 PR1. I just 
tried a "document.open();" after the document was finished loading, and it 
cleared the page, on both linux build ID 2000072020 and Windows 95 build ID 
2000072108.

On a different note, how will this backward compatibility issue be implemented? 
I believe that also during document loading document.open() should clear the 
existing document, like the DOM 1&2 specs say. Fixing this bug will clash with 
that unless there's some way to restrict it to say NavQuirks mode.

CC'ing ekrock.
The behavior of document.open() in Mozilla must be compatible with that of 
document.open() in Nav4 and IE5. Anything else would Break The Web. 
(document.open() is very widely used as it's existed since JS 1.0 in Nav2, if 
memory serves.) If the specs say something else, jst please propose that this be 
amended and noted in the errata.
Keywords: correctness, nsbeta3
Marking nsbeta3+
Whiteboard: [nsbeta3+]
PDT agrees P2
Adding PDTP2 annotation...
Whiteboard: [nsbeta3+] → [nsbeta3+][PDTP2]
Whiteboard: [nsbeta3+][PDTP2] → [nsbeta3+][PDTP2][Have fix]
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Verified with 2001-020608.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: