Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 12 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /domparsing/tentative/positional-template-child.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8" />
<title>
HTML partial updates - template child
</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
for (const safe of [true, false]) {
for (const method of [
"afterHTML",
"beforeHTML",
"replaceWithHTML",
"streamAfterHTML",
"streamBeforeHTML",
"streamReplaceWithHTML",
]) {
const method_name = `${method}${safe ? "" : "Unsafe"}`;
test(() => {
const template = document.createElement("template");
const child = document.createElement("div");
template.appendChild(child);
assert_throws_dom("HierarchyRequestError", () => {
if (method.startsWith("stream")) {
child[method_name]();
} else {
child[method_name]('<span></span>');
}
});
}, `${method_name} on a direct child of a template element throws HierarchyRequestError`);
}
}
</script>
</body>