Re: [WICG/webcomponents] Need a callback for when children changed or parser finished parsing children (#809)

We have bypassed this over the years in multiple ways.
I plea for Web Component gurus to work on real problems.

https://jsfiddle.net/WebComponents/ar7jengd/

````html
<template id="MY-ELEMENT">
  <img src="" onerror='this.getRootNode().host.parsed("img onerror")'>
  <style onload='this.getRootNode().host.parsed("style onload")'></style>
</template>

<my-element>
  <span></span>
  <b></b>
</my-element>

<script>
  customElements.define('my-element', class extends HTMLElement {
    constructor() {
      const templateById = (id) => document.getElementById(id);
     const clone = (id) => templateById(id).content.cloneNode(true);
     super().attachShadow({mode:"open"}).append(clone(this.nodeName));
    }
    connectedCallback() {
      setTimeout(() => this.parsed("timeout"))
      requestAnimationFrame(() => this.parsed("rAF"));
      console.log("connectedCallback");
    }
    parsed(ref){
     console.log("parsed() called by", ref, this.children)
    }
  });
</script>
````

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/809#issuecomment-1456790982
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/809/1456790982@github.com>

Received on Monday, 6 March 2023 19:08:41 UTC