summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/mutation-event-remove-inserted-node.html
blob: 3956b847e4a7bc8a90effe621fafc5e06d5299f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<body>

<p>This test verifies that a mutation event that removes inserted nodes from the 
document doesn't crash upon the insertion of a new node into the document.</p>
<p>PASS: You didn't crash.</p>

<script id="dummy"></script>

<script>
if (window.testRunner)
    testRunner.dumpAsText();

function mutationListener(event)
{
    var element = event.srcElement;
    element.parentNode.removeChild(element);
}

document.body.addEventListener("DOMNodeInserted", mutationListener, false);

/* appendChild */
document.body.appendChild(document.createElement("script"));

/* insertBefore */
document.body.insertBefore(document.createElement("script"), document.getElementById("dummy"));

/* replaceChild */
document.body.replaceChild(document.createElement("script"), document.getElementById("dummy"));

/* Parser-inserted nodes don't fire mutation events. */
</script>

</body>