blob: b5a7d7c5ff110a292ec37f31f4595d6df098ca3d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.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');
var numCalled = 0;
function handler(){
numCalled++;
if (numCalled < 2)
return;
document.removeEventListener("DOMNodeRemoved", handler, false);
target.parentNode.removeChild(target);
newChild.appendChild(target);
}
document.addEventListener("DOMNodeRemoved", handler, false);
shouldThrowErrorName("target.replaceChild(newChild, oldChild);", "HierarchyRequestError");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>