Closed Bug 158113 Opened 22 years ago Closed 22 years ago

window properties get reset after document.write

Categories

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

x86
Windows NT
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 114461

People

(Reporter: bugzilla, Assigned: jst)

Details

(Keywords: testcase)

Attachments

(1 file)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.1b) Gecko/20020717
BuildID:    2002071708

After performing a document.write, window properties explicitly set in
javascript become undefined.

Reproducible: Always
Steps to Reproduce:
1. Open attached testcase


Actual Results:  First dialog reads "title: Title lizard: Mozilla"
Second dialog reads "title: undefined lizard: undefined"


Expected Results:  Both dialogs should read "title: Title lizard: Mozilla"


On page load, the following javascript is executed:

  window.title = "Title";
  window.lizard = "Mozilla";
  alert('title: ' + window.title + ' lizard: ' + window.lizard);
  window.document.write();
  alert('title: ' + window.title + ' lizard: ' + window.lizard);

After the write, the window properties have been cleared.  Changing the contents
of the document should not affect window properties (assuming the changes don't
invoke some scripting that alters window properties).  Even if there is some
rationale for resetting some standard properties on document content change, I
don't see why a property like mozilla.lizard should be affected.
Attached file Original testcase
As referenced in original report
Keywords: testcase
Confirmed buildID 2002071708/win2000.

See bug 24204, bug 24479 
Oops, Comment #1 =~ s/mozilla.lizard/window.lizard/
Testcase gives different results under Netscape 6:

The first alert reads "title: Title lizard: Mozilla".
The second alert reads "title: Title lizard: undefined".

Tested with Netscape 6.2.3
Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.4.1) Gecko/20020508
Netscape6/6.2.3 
This is a dupe of bug 114461 which is about document.open() clearing the JS
scope, and document.write() implicitly calls document.open()...

*** This bug has been marked as a duplicate of 114461 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
verified dupe
Status: RESOLVED → VERIFIED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: