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 always fire in the exact order of the element reactions](https://github.com/whatwg/dom/issues/1111) they represent, 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 an 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 that try to make vanilla custom elements (or use libs like Lit which don't have childConnectedCallback, etc)), face these difficult issues, then become motivated to go use something else like Solid, React, Vue, Svelte, etc. **We can change this story.**

Very much agree. Amazon's concept of "eat your own dog food" here applies here. If browsers used native web components to implement thier own native components (e.g. div, span, ul), I'm sure we would have a much better API. Maybe they could have a C version of the JavaScript version that developers use.

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

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

Received on Saturday, 6 May 2023 12:40:46 UTC