Closed Bug 24698 Opened 26 years ago Closed 25 years ago

{doc.open}Event handlers fail to be cleaned up on document.open()

Categories

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

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: matchen, Assigned: joki)

References

Details

(Whiteboard: [nsbeta2-][fixinhand][nsbeta3+])

Using document.open("text/html", "replace") followed by a document.write() fails to remove event handlers from the previous document. For instance, onmousemove from the BODY tag of the old document still gets called even though the new document has no onmousemove handler. Try the following: <html> <head> <title></title> <script type="text/javascript"> function count() { var tmp = parseInt(window.cnt+''); cnt = (isNaN(tmp) ? 0 : tmp); cnt++; window.status = 'Moved '+cnt+' times!'; } function go() { window.document.open("text/html", "replace"); window.document.write("<h1>Replaced!</h1>"); window.document.close(); } </script> </head> <body onmousemove="count();"> <button onclick="go();">Replace!</button> </body> </html> After you load the page, move the mouse and notice the window.status bar. Now move over to the "Replace!" button and press it. The WHOLE document has been rewritten with a document that does NOT have a mousemove handler, yet the window.status still updates. Curious! This bug occurs on Windows NT running the nightly win32 build from 1/21/2000 and is reproducible.
To refine the problem: document.open() on an existing document doesn't result in upward notification to the container. As a result, the window isn't cleared (in this example, the body onmousemove gets moved up to the window for compatibility).
Related to bug 17351. The complete document.open/write/close mechanism needs to be done again so that the containing webshell is more involved. Marking M15 for now. It's a big enough change that it should get done early. Adding {doc.open} to summary to track related bugs.
Status: NEW → ASSIGNED
Depends on: 17351
Summary: Event handlers fail to be cleaned up after document is replaced → {doc.open}Event handlers fail to be cleaned up on document.open()
Target Milestone: M15
Unfortunately I didn't get to this yet, moving to M16
Target Milestone: M15 → M16
Nominating nsbeta2. We have to start drawing a line on DOM0 backward compatibility; these bugs are supposed to be a high priority for nsbeta2 per the beta2 criteria.
Keywords: nsbeta2
Setting to [nsbeta2+][6/15]. nsbeta3 stopper if doesn't make nsbeta2.
Whiteboard: [nsbeta2+][6/15]
Tom, could you have a look at this?
Assignee: vidur → joki
Status: ASSIGNED → NEW
Whiteboard: [nsbeta2+][6/15] → [nsbeta2+][6/15] fix in hand, waiting for review
Cleaning up status whiteboard by marking beta2 minus (6/15 has passed) I'm sorry folks were too doomed to get this fix landed in time. I know Joki is pretty doomed with other beta2 bugs, so I'm going with Ekrock's request an nominating this for beta3.
Keywords: nsbeta3
Whiteboard: [nsbeta2+][6/15] fix in hand, waiting for review → [nsbeta2-] fix in hand, waiting for review
Adding [fixinhand] to allow easier sorting while waiting for nsbeta3 tree checkins.
Status: NEW → ASSIGNED
Whiteboard: [nsbeta2-] fix in hand, waiting for review → [nsbeta2-] [fixinhand]
M16 has been out for a while now, these bugs target milestones need to be updated.
Updating Milestone to M18.
Target Milestone: M16 → M18
Markin nsbeta3+...
Whiteboard: [nsbeta2-] [fixinhand] → [nsbeta2-][fixinhand][nsbeta3+]
Joki's fixes have been checked in by saari. Marking fixed.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Verified with 2000-09-13-09.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.