Re: [whatwg/dom] Hook for SVG and HTML script element insertion (#575)

<div id=host></div>
<script>
const host = document.getElementById("host"),
      shadow = host.attachShadow({ mode: "closed" }),
      slot = shadow.appendChild(document.createElement("slot")),
      df = document.createDocumentFragment(),
      s1 = df.appendChild(document.createElement("script")),
      s2 = df.appendChild(document.createElement("script"));

slot.addEventListener("slotchange", e => console.log(e));
s1.textContent = "df.appendChild(s1); df.appendChild(s2);";
s2.textContent = "console.log('hmm');";
host.appendChild(df);
</script>

<script>
customElements.define("ce-1", class CE1 extends HTMLElement {
  constructor() {
    super();
  }
  connectedCallback() {
    console.log("ce-1 connected");
  }
});

const df = document.createDocumentFragment(),
      s = df.appendChild(document.createElement("script")),
      ce1 = df.appendChild(document.createElement("ce-1"));
s.textContent = "df.appendChild(ce1);";
document.head.appendChild(df);
</script>

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/575#issuecomment-379655672

Received on Monday, 9 April 2018 07:09:13 UTC