tor-browser

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

Node-appendChild-cereactions-vs-script.window.js (801B)


      1 const results = [];
      2 test(() => {
      3  class Script1 extends HTMLScriptElement {
      4    constructor() {
      5      super();
      6    }
      7    connectedCallback() {
      8      results.push("ce connected s1");
      9    }
     10  }
     11  class Script2 extends HTMLScriptElement {
     12    constructor() {
     13      super();
     14    }
     15    connectedCallback() {
     16      results.push("ce connected s2");
     17    }
     18  }
     19  customElements.define("script-1", Script1, { extends: "script" });
     20  customElements.define("script-2", Script2, { extends: "script" });
     21  const s1 = new Script1();
     22  s1.textContent = "results.push('s1')";
     23  const s2 = new Script2();
     24  s2.textContent = "results.push('s2')";
     25  document.body.append(s1, s2);
     26  assert_array_equals(results, ["s1", "s2", "ce connected s1", "ce connected s2"]);
     27 }, "Custom element reactions follow script execution");