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-script-eval.html - WPT Dashboard Interop Dashboard
<!DOCTYPE HTML>
<meta charset="utf-8" />
<title>HTML partial updates - content template updates script with plain text but doesn't execute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script id="placeholder" contentname="s">
window.state = "init";
</script>
<script>
window.placeholder = document.querySelector("#placeholder");
</script>
<template contentmethod="replace-children"><script contentname="s">window.state = 'patched';</script></template>
<script>
test(() => {
assert_equals(placeholder.firstElementChild, null);
assert_equals(placeholder.textContent, "window.state = 'patched';");
// The script has already started, so patching it would have no effect.
assert_equals(window.state, "init");
});
</script>