blob: 4c024b45e6a711f8e45d76e9d3ae17db6dfb0392 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test.js"></script>
<script>
description(`This tests re-parenting a child of the document fragment during an insertion so as to create a circular node tree.<br>
WebKit should detect this case and throw HierarchyRequestError.`);
fragment = document.createDocumentFragment();
container = document.createElement('div');
refChild = container.appendChild(document.createElement('section'));
child = fragment.appendChild(document.createElement('div'));
childShadowRoot = child.attachShadow({mode: 'closed'});
fragment.addEventListener('DOMSubtreeModified', function() {
childShadowRoot.appendChild(container);
});
shouldThrowErrorName(`container.replaceChild(fragment, refChild)`, 'HierarchyRequestError');
shouldBe('container.parentNode', 'childShadowRoot');
shouldBe('child.parentNode', 'null');
</script>
</body>
</html>