blob: a20e4ab4be3a69d093dfb88cabb11483622a6b9e [file] [log] [blame]
<body>
<p>This test verifies that a &lt;script&gt; element that removes itself
from the document doesn't crash upon insertion into the document.</p>
<p>PASS: You didn't crash.</p>
<script id="dummy"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var scriptElement;
var scriptText = "var self = document.getElementById('script'); self.parentNode.removeChild(self);";
/* appendChild */
scriptElement = document.createElement("script");
scriptElement.setAttribute("id", "script");
scriptElement.appendChild(document.createTextNode(scriptText));
document.body.appendChild(scriptElement);
/* insertBefore */
scriptElement = document.createElement("script");
scriptElement.setAttribute("id", "script");
scriptElement.appendChild(document.createTextNode(scriptText));
document.body.insertBefore(scriptElement, document.getElementById("dummy"));
/* replaceChild */
scriptElement = document.createElement("script");
scriptElement.setAttribute("id", "script");
scriptElement.appendChild(document.createTextNode(scriptText));
document.body.replaceChild(scriptElement, document.getElementById("dummy"));
</script>
<script id="script">
/* parser insertion */
eval(scriptText);
</script>
</body>