Closed
Bug 646824
Opened 14 years ago
Closed 14 years ago
appendChild does not evaluate the last script
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 645115
People
(Reporter: Manuel.Serrano, Unassigned)
Details
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20110321 Firefox/4.0
Build Identifier: Firefox 4.0
Consider the following JS code:
foo.js:
function click( n ) {
var el = document.createElement( "div" );
var s = "<script>alert( \"1\" )</script>; bar <script>alert( \"2\"</script>; ";
el.innerHTML = s;
n.appendChild( el );
}
and then the following HTML file:
foo.html
<HTML>
<script src="/users/serrano/trashcan/foo.js" type='text/javascript'></script>
<DIV id="foo" onclick="click(this)">
click me
</DIV>
</HTML>
When the button is clicked, only *one* alert is executed. The second one is ignored. Actually, appendChild evaluate all the scripts but the last one.
Reproducible: Always
Steps to Reproduce:
1. firefox file:///tmp/foo.html
2. click the "click" work
3.
Actual Results:
one "1" is raised in a popup
Expected Results:
"1" _then_ "2" should be popped.
Comment 1•14 years ago
|
||
Note, you have a mistake in the script.
alert( \"2\" misses )
Comment 2•14 years ago
|
||
Usually it is better to attach testcases using "Add an attachment"
Comment 3•14 years ago
|
||
Per HTML5 spec, neither script should be evaluated in this case.
The fact that the first one is evaluated is bug 645115.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Reporter | ||
Comment 4•14 years ago
|
||
Sorry, my mistake in a cut-and-paste for the error report. The actual script is:
function click( n ) {
var el = document.createElement( "div" );
var s = "<script>alert( \"1\" )</script>; bar <script>alert( \"2\" )</script>; ";
el.innerHTML = s;
n.appendChild( el );
}
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Comment 5•14 years ago
|
||
Yes, but this is still a duplicate.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago → 14 years ago
Resolution: --- → DUPLICATE
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•