blob: 9948b85e96617da0d115209102aa5ac6e2a08c89 [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('template'));
fragment.addEventListener('DOMSubtreeModified', function() {
child.content.appendChild(container);
});
shouldThrowErrorName(`container.insertBefore(fragment, refChild)`, 'HierarchyRequestError');
shouldBe('container.parentNode', 'child.content');
shouldBe('child.parentNode', 'null');
</script>
</body>
</html>