tor-browser

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

template-contentmethod-innerHTML-within.html (924B)


      1 <!DOCTYPE HTML>
      2 <meta charset="utf-8" />
      3 <title>HTML partial updates: patching via innerHTML</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 <div id="container"></div>
      8 <script>
      9 test(() => {
     10    const container = document.getElementById("container");
     11    container.innerHTML = `
     12        <div id="placeholder" contentname=p>Old content in innerHTML</div>
     13        <template contentmethod="replace-children">
     14            <div contentname="p">New content</div>
     15        </template>`;
     16    const placeholder = container.querySelector("div");
     17    assert_equals(placeholder.id, "placeholder");
     18    assert_equals(placeholder.textContent, "New content");
     19    assert_equals(container.querySelector("template"), null);
     20 }, "<template contentmethod> in innerHTML patching inner element");
     21 </script>