Closed Bug 63591 Opened 25 years ago Closed 25 years ago

getElementById fails for document.write(str) content

Categories

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

x86
Windows NT
defect
Not set
major

Tracking

()

VERIFIED DUPLICATE of bug 63423

People

(Reporter: oliver, Assigned: jst)

Details

If you have a HTML dosument where a script element is loaded from a source file, When the referenced file tries to getElementByID for an element that it has added using document.write a null will be returned. thats a **** explanation so here's a test case. <!--TESTCASE --> <!-- main html file --> <html> <head><title>Mozilla Bug</title> </head> <body> <script language="JavaScript" src="test.js"></script> <script> document.write('<div id="testing1234">this is a testdiv</div>'); if(document.getElementById("testing1234")==null){ document.write("Mozilla failed test<br>"); }else{ document.write("Mozilla passed test<br>"); } </script> </body> </html> <!-- test.js --> document.write('<div id="testing123">this is a testdiv</div>'); if(document.getElementById("testing123")==null){ document.write("Mozilla failed test<br>"); }else{ document.write("Mozilla passed test<br>"); }
Updating summary.
Summary: getElementById cant find element in a included Javascript file → getElementById fails for document.write(str) content
Confirming with Mozilla trunk build 2000122105 on WinNT. I saved the main HTML file, and the JS file as "test.js". After altering the text of each to identify things more clearly, I got this output from the test: This is a <DIV> element that has been document.written inside test.js Mozilla failed test This is a <DIV> element that has been document.written inside main HTML file- Mozilla passed test Browser, not engine ---> DOM Level 0
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: Javascript Engine → DOM Level 0
Ever confirmed: true
QA Contact: pschwartau → desale
I think this is a duplicate of Bug 63423.
Yup, this is a dupe of 63423. *** This bug has been marked as a duplicate of 63423 ***
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
Verified as duplicate -
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.