Re: [webcomponents] Need "slotting changed" event (#288)

Here's a concrete API proposal:

Add `boolean slotAssignments = false` to [`MutationObserverInit`](https://dom.spec.whatwg.org/#dictdef-mutationobserverinit).

We can add a new step to each DOM mutation such as the concept [insert](https://dom.spec.whatwg.org/#concept-node-insert) to [queue a mutation record](https://dom.spec.whatwg.org/#queue-a-mutation-record) of type `slotAssignment`.  This would result in each slot synchronously getting a new mutation record of type `slotAssignment` whenever a slot assignment has changed.  This is observable if the mutation observer's `takeRecords()` is called.  If there are multiple mutations that affect slot assignments, each such mutation queues a new record in this model.

Alternatively, we can store the list of [distributed nodes](http://w3c.github.io/webcomponents/spec/shadow/#dfn-distributed-nodes) for each slot element at the beginning of each micro task, and queue a mutation record if the list of nodes had changed at the end of the micro task.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/288#issuecomment-176476004

Received on Thursday, 28 January 2016 23:16:19 UTC