Closed
Bug 170719
Opened 22 years ago
Closed 22 years ago
can't use javascript object twice
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 114461
People
(Reporter: zvodar, Assigned: jst)
References
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826
Look at these 2 files:
file 1: test.js
---------------
var test = new Object( );
test.version = "1";
file 2: test.html
------------------
<html>
<head>
<title>test</title>
<script language="javascript" src="test.js"></script>
<script language="javascript">
main = function( ) {
document.write( test.version + "<br>" );
document.write( test.version + "<br>" );
}
window.onload = main;
</script>
</head>
<body>
</body>
</html>
Only the first "document.write" works, the other one failed with a "test is not
defined" error message in javascript console...
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1•22 years ago
|
||
Confirming bug with Mozilla trunk binary 20020924xx on WinNT.
This has something to do with document.write(), because if we
replace it in the testcase with alert(), we do not see the bug.
Reassigning to DOM Level 0 -
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → DOM Level 0
Ever confirmed: true
QA Contact: pschwartau → desale
Comment 2•22 years ago
|
||
Um... document.write in the onload handler (after the document has finished
loading) implicitly calls document.open() and thus wipes out the old document
and therefore the old script context (clearing the JS scope in the process). We
already have bugs on this; not sure whether they're resolved (invalid, wontfix,
etc) or not.
Comment 3•22 years ago
|
||
*** Bug 170907 has been marked as a duplicate of this bug. ***
Comment 4•22 years ago
|
||
Duplicate of bug 114461 - "document.open clobbers js context"
*** This bug has been marked as a duplicate of 114461 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•