<!DOCTYPE html>
<html>
<body>
<div id="templateParent"><template id="template"><span></span></template></div>
<script src="../../resources/js-test.js"></script>
<script>

description('This tests inserting the parent of a template element into its content document fragment<br>'
    + 'after adopting the document fragment to another document. WebKit should throw HierarchyRequestError');

const newDocument = document.implementation.createHTMLDocument();
newDocument.adoptNode(template.content);
shouldThrowErrorName('template.content.appendChild(templateParent)', 'HierarchyRequestError');
shouldThrowErrorName('template.content.insertBefore(templateParent, template.content.firstChild)', 'HierarchyRequestError');
shouldThrowErrorName('template.content.replaceChild(templateParent, template.content.firstChild)', 'HierarchyRequestError');

</script>
</body>
</html>
