blob: fe29587d5d95df1bd17480fa7f3034cdbe79d285 [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.layoutTestController)
layoutTestController.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>