blob: cc4aa2bfd5b93018a4a38294aeeb1d5f50a95270 [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');
function handler(){
document.removeEventListener("DOMNodeRemoved", handler, false);
newChild.parentNode.removeChild(newChild);
target.parentNode.removeChild(target);
newChild.appendChild(target);
}
document.addEventListener("DOMNodeRemoved", handler, false);
shouldThrowErrorName("target.replaceChild(newChild, oldChild);", "NotFoundError");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>