Closed
Bug 501846
Opened 15 years ago
Closed 14 years ago
document.getElementBy fails to find the object after a document.write
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: fabrizio_blanco, Unassigned)
References
Details
(Keywords: testcase, Whiteboard: [fixed by the HTML5 parser])
Attachments
(1 file)
(deleted),
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5 here is the code snippet that shows the problem: <script> document.write("<iframe id='xyz' name='xyz' width=728 height=90> </iframe>"); alert(document.getElementById('xyz')); </script> it will return null instead of the iframe object. This happens only on firefox 3.5 Reproducible: Always Steps to Reproduce: <script> document.write("<iframe id='xyz' name='xyz' width=728 height=90> </iframe>"); alert(document.getElementById('xyz')); </script> Actual Results: null Expected Results: Object
Comment 1•15 years ago
|
||
This seems Firefox-only but is not a regression.
Component: General → DOM: Core & HTML
Product: Firefox → Core
QA Contact: general → general
Comment 2•15 years ago
|
||
Comment 3•15 years ago
|
||
Workaround: add <body> before <script> Similar to bug 178258 but doesn't seem to get fixed by my patch there...
Reporter | ||
Comment 4•15 years ago
|
||
Adding body inside the document write seems to make it work as well: <script> document.write("<body><iframe id='xyz' name='xyz' width=728 height=90> </iframe></body>"); alert(document.getElementById('xyz')); </script>
![]() |
||
Comment 5•15 years ago
|
||
Looks like a variant of the "scripts are hoisted to head" thin. Henri, is this an issue with the html5 parser? If not, can you please add a dep on that bug here, and maybe add a "todo" mochitest to the tree immediately, so we remember to enable it when we flip the pref?
Not an issue with the HTML5 parser.
Depends on: html5-parsing
Updated•15 years ago
|
Flags: in-testsuite?
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [fixed by the HTML5 parser]
You need to log in
before you can comment on or make changes to this bug.
Description
•