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/stream-append-with-template-contentmethod.html - WPT Dashboard Interop Dashboard
<!DOCTYPE HTML>
<meta charset="utf-8" />
<title>streamHTML methods can apply template with contentmethod</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div contentname=p id="placeholder">Old content</div>
<script>
promise_test(async t => {
const writable = document.body.streamAppendHTMLUnsafe();
const writer = writable.getWriter();
await writer.write('<template contentmethod="replace-children">');
await writer.write("<div contentname=p>");
await writer.write("New content");
await writer.write("</div>");
await writer.close();
assert_equals(document.querySelector("#placeholder").textContent, "New content")
});
</script>