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

I just want to voice that a non-MutationObserver API will be far more ergonomic and developer-friendly, f.e. callbacks or events that are guaranteed to fire *in the exact order the reactions happened*.

[MutationObserver callbacks do not fire in the exact order of the element reactions they represent](https://github.com/whatwg/dom/issues/1111), making them extremely difficult to use.

Implementing callbacks for custom elements such as `childConnectedCallback`, `childComposedCallback` (when a child is composed to your custom element by being child of your element's ShadowRoot, or via distribution to a slot child of your element's ShadowRoot), etc, has proven to be very difficult because of that issue with MutationObserver.

If we can get a API with a simple intuitive ordering of events, that would be very valuable for developer productivity!

I believe that there are a group of people try to make vanilla custom elements, face these difficult issues, then become motivated to go use something else like React, Vue, Svelte, etc. That's not the story we want.

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

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

Received on Friday, 5 May 2023 16:43:04 UTC