blob: 26941413b9cfcc61c76418cc9f7eae2165330ce8 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id="parent"><br id="child"><br id="next"></div>
<script>
test(() => {
let parent = document.querySelector('#parent');
parent.addEventListener('DOMSubtreeModified', () => {
document.body.appendChild(document.querySelector('#next'));
}, {once: true});
let new_node = document.createElement('span');
assert_throws('NotFoundError', () => {
parent.replaceChild(new_node, document.querySelector('#child'));
});
assert_equals(parent.firstChild, null);
assert_equals(new_node.parentNode, null);
assert_equals(new_node.nextSibling, null);
}, 'Re-parenting a reference node should not crash replaceChild().');
</script>
</body>