chromium/third_party/blink/web_tests/dom/mutation-event-tests/fast/events/mutation-during-replace-child.html

<!DOCTYPE html>
<html>
<head>
<script src="../../../../resources/js-test.js"></script>
</head>
<body>
<div>
  <div id="target">
    <b></b><b id="oldChild"></b><b></b>
  </div>
  <div id="newChild"></div>
</div>

<script>
description("Ensures that replaceChild() throws an exception if mutation even handler does something wrong");
var target = document.getElementById('target');
var oldChild = document.getElementById('oldChild');
var newChild = document.getElementById('newChild');

function handler(){
    document.removeEventListener("DOMNodeRemoved", handler, false);
    newChild.parentNode.removeChild(newChild);
    target.parentNode.removeChild(target);
    newChild.appendChild(target);
}
document.addEventListener("DOMNodeRemoved", handler, false);
shouldThrow("target.replaceChild(newChild, oldChild);", '"NotFoundError: Failed to execute \'replaceChild\' on \'Node\': The node to be removed is no longer a child of this node. Perhaps it was moved in response to a mutation?"');
</script>
</body>
</html>