Bug 11361
Summary: | Dynamically added script element is executed twice if its parent is also a dynamically create element | ||
---|---|---|---|
Product: | WebKit | Reporter: | mharder |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ap, bleroy, mrowe |
Priority: | P2 | ||
Version: | 419.x | ||
Hardware: | Mac | ||
OS: | OS X 10.4 |
mharder
It seems that a dynamically added script element is executed twice if its parent is also a dynamically create element. Consider the following code:
var script1 = document.createElement("script");
script1.type = "text/javascript";
script1.innerHTML = "alert('script1');";
var container = document.createElement("div");
container.appendChild(script1);
document.body.appendChild(container);
When this code is run, the "alert('script1');" code is executed twice. If you change the last line to:
document.body.appendChild(script1);
Then the "alert('script1');" code is only executed once.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
mharder
*** This bug has been confirmed by popular vote. ***
Mark Rowe (bdash)
This has been fixed on ToT. It works as expected in the latest nightly build.
[What is the correct Bugzilla resolution in this instance? FIXED suggests we explicitly fixed this issue, while WORKSFORME suggests it was never broken]
Alexey Proskuryakov
(In reply to comment #2)
> [What is the correct Bugzilla resolution in this instance? FIXED suggests we
> explicitly fixed this issue, while WORKSFORME suggests it was never broken]
I prefer the WORKSFORME resoultion, because such reports should ideally be re-checked for regressions before release (if the problem "magically" disappeared, we may not have an automated test). Bugs that we could never reproduce usually end up as INVALID.