template-contentmethod-script-children.html (823B)
1 <!DOCTYPE HTML> 2 <meta charset="utf-8" /> 3 <title>HTML partial updates - a script inside a patch should execute</title> 4 <link rel=help href="https://github.com/WICG/declarative-partial-updates"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 8 <section id="placeholder" contentname="p"> 9 <script> 10 window.state = "init"; 11 </script> 12 </section> 13 <template contentmethod="replace-children"><section contentname=p><script>window.state = 'patched';</script></section></template> 14 <script> 15 test(() => { 16 assert_not_equals(document.querySelector("#placeholder").firstElementChild, null); 17 assert_equals(document.querySelector("#placeholder").firstElementChild.textContent, "window.state = 'patched';"); 18 assert_equals(window.state, "patched"); 19 }); 20 21 </script>