Closed Bug 147581 Opened 23 years ago Closed 23 years ago

Script linked by using innerHTML does not get evaluated

Categories

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

x86
Windows 2000
defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: ddumitriu, Assigned: jst)

References

Details

Attachments

(4 files)

I have an empty DIV in the document. At some point, I dynamically create an IFRAME in which I load a different document. Upon loading, this document (the one in the IFRAME) identifies the DIV in the parent document and sets its innerHTML property to some html which also includes a linked script (with src=). Then the IFRAME is destroyed. The html is rendered ok in the DIV, but the script it references does not get evaluated. Functions or variables defined in it are not accessible. However, the JavaScript Debugger will see the script and its contents. This behavior was introduced in 1.0RC3. Everything worked fine in 0.9.8. IE6.0 does not seem to parse the script either.
Load this document in the browser. The other files are referenced by this one.
Attached file Part of the test case
Attached file Part of the test case
Attached file Part of the test case
Right, IE doesn't execute scripts in .innerHTML either, and that's the reason for Mozilla not doing it. This is as designed, <script> tags are not executed (nor are external scripts loaded) when they appear in .innerHTML. INVALID.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
See also bug 127016, "appendChild(cloneNode(true)) causes inline scripts to execute again".
*** Bug 320226 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: