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

Just wanted to add that I want keep wanting the "parsing done" callback, especially for progressive enhancement.

```html
<my-custom-element>
  …some acceptable pre-JS markup that's eventually enhanced…
</my-custom-element>
```

In cases like this, I want to run JS when parsing is complete, then look at the contents, and use it to initialise the interactive element (perhaps move everything into shadow dom). Edits to element content are ignored after parsing.

I find myself having to do:

```html
<my-custom-element>
  …some acceptable pre-JS markup that's eventually enhanced…
</my-custom-element>
<script>
  {
    const el = document.currentScript.previousElementSibling;
    customElements.whenDefined('my-custom-element')
      .then(() => el.enhance());
  }
</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/w3c/webcomponents/issues/809#issuecomment-532525717

Received on Wednesday, 18 September 2019 05:34:11 UTC