[WICG/webcomponents] [custom-elements] Why is `attributeChangedCallback` synchronous? (Issue #963)

Why is `attributeChangedCallback` synchronous despite the fact that DOM `MutationEvent`s were removed because they were synchronous and this was deemed to be a bad thing?

So, in effect, `attributeChangedCallback` restores the "bad" nature of DOM MutationEvents: 1000 custom elements with `attributeChangedCallback`s is essentially equivalent to 1000 elements with `DOMAttrModified` events, yet this hasn't been considered a bad thing in the case of custom elements.

Perhaps there are two questions here actually:

- Why is it ok for custom elements to have synchronous events and not for DOM MutationEvents?
- Why didn't we fix MutationEvents then? For example, we could have easily made MutationEvents fire "batched" in a microtask. Problem solved, without the messier `MutationObserver` API.

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

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

Received on Sunday, 31 July 2022 00:36:06 UTC