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-patchfor-scripting.html - WPT Dashboard Interop Dashboard
<!DOCTYPE HTML>
<meta charset="utf-8" />
<title>HTML partial updates - a script inside a patch should execute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<section id="placeholder">
<script>
window.state = "init";
</script>
</section>
<template patchfor="placeholder"><script>window.state = 'patched';</script></template>
<script>
test(() => {
assert_not_equals(document.querySelector("#placeholder").firstElementChild, null);
assert_equals(document.querySelector("#placeholder").firstElementChild.textContent, "window.state = 'patched';");
assert_equals(window.state, "patched");
});
</script>