tor-browser

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

Node-appendChild-text-in-script.tentative.html (892B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>Node.appendChild: inserting two text nodes in an empty script</title>
      4 <script src=/resources/testharness.js></script>
      5 <script src=/resources/testharnessreport.js></script>
      6 <body>
      7  <script id="script"></script>
      8 <script>
      9 const happened = [];
     10 test(() => {
     11  const script = document.getElementById("script");
     12  const df = document.createDocumentFragment();
     13  df.appendChild(new Text("happened.push('t1');"));
     14  df.appendChild(new Text("happened.push('t2');"));
     15  assert_array_equals(happened, []);
     16  script.appendChild(df);
     17  assert_array_equals(happened, ["t1", "t2"]);
     18  // At this point it's already executed so further motifications are a no-op
     19  script.appendChild(new Text("happened.push('t3');"));
     20  script.textContent = "happened.push('t4');"
     21  script.text = "happened.push('t5');"
     22  assert_array_equals(happened, ["t1", "t2"]);
     23 });
     24 </script>