<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<body>
<div><i></i><table><b><p><iframe></iframe><script>
/*
The adoption agency algorithm, step 10, will end up calling
ContainerNode::parserInsertBefore with the following arguments:
|this| == <div>
|newChild| == <p>
|nextChild| == <table>
parserInsertBefore calls parserRemoveChild(newChild), which
triggers the unload event in the contained iframe.
*/
var containerNode = document.querySelector("div");
var firstChild = document.querySelector("i");
var nextChild = document.querySelector("table");
frames[0].onunload = function() {
    containerNode.removeChild(nextChild);
}
</script></b></p><!--This order is intentional to force reparenting--></table></div>
<script>
description("Ensure that DOM is consistent after a specific child has been removed during reparenting.")
shouldBe("containerNode.firstChild", "firstChild");
shouldBe("nextChild.previousSibling", "null");
</script>
</body>