Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/dom/partial-updates/tentative/template-contentmethod-innerHTML-within.html - WPT Dashboard Interop Dashboard
<!DOCTYPE HTML>
<meta charset="utf-8" />
<title>HTML partial updates: patching via innerHTML</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="container"></div>
<script>
test(() => {
const container = document.getElementById("container");
container.innerHTML = `
<div id="placeholder" contentname=p>Old content in innerHTML</div>
<template contentmethod="replace-children">
<div contentname="p">New content</div>
</template>`;
const placeholder = container.querySelector("div");
assert_equals(placeholder.id, "placeholder");
assert_equals(placeholder.textContent, "New content");
assert_equals(container.querySelector("template"), null);
}, "<template contentmethod> in innerHTML patching inner element");
</script>