tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

template-contentmethod-script-eval.html (887B)


      1 <!DOCTYPE HTML>
      2 <meta charset="utf-8" />
      3 <title>HTML partial updates - content template updates script with plain text but doesn't 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 <script id="placeholder" contentname="s">
      9    window.state = "init";
     10 </script>
     11 <script>
     12    window.placeholder = document.querySelector("#placeholder");
     13 </script>
     14 <template contentmethod="replace-children"><script contentname="s">window.state = 'patched';</script></template>
     15 <script>
     16 test(() => {
     17    assert_equals(placeholder.firstElementChild, null);
     18    assert_equals(placeholder.textContent, "window.state = 'patched';");
     19    // The script has already started, so patching it would have no effect.
     20    assert_equals(window.state, "init");
     21 });
     22 
     23 </script>