- From: Joseph Orbegoso Pea <notifications@github.com>
- Date: Fri, 16 Dec 2016 15:36:02 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/webcomponents/issues/617@github.com>
I'm looking at [#concept-node-insert](https://dom.spec.whatwg.org/#concept-node-insert) and trying to understand the order in which `slotchange` events are fired on a chain of slots across node trees, where a "chain of slots" is a slot assigned to another slots assigned to another slot, across a tree of node trees. You and I can glean from [this fiddle](https://jsfiddle.net/5rh7g3Lq) that the order of `slotchange` events (in Chrome) happens from shallowest slot of root-most node tree to deepest slot of leaf-most node tree (see the console output). I am trying to verify if this is in the spec; I don't want to rely on Chrome-only behavior that I've determined experimentally. I am following this chain of links in the documentation: [#concept-node-insert](https://dom.spec.whatwg.org/#concept-node-insert) -> [#assign-a-slot](https://dom.spec.whatwg.org/#assign-a-slot) -> [#assign-slotables](https://dom.spec.whatwg.org/#assign-slotables) -> [#signal-a-slot-change](https://dom.spec.whatwg.org/#signal-a-slot-change) -> [#queue-a-mutation-observer-compound-microtask](https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask) -> [#notify-mutation-observers](https://dom.spec.whatwg.org/#notify-mutation-observers) However, the chain ends in firing a **mutation observer compound microtask** for the slot on which **assign slotables** happens. This does explain how deeper slots which have shallower slots assigned to them have their `slotchange` events triggered when the assigned slotables of a shallow-most slot changes. What I'm referring to, if you look at my fiddle, is that when the **assign slotables** algorithm runs, it triggers `slotchange` on all the slots despite the fact that a slot's slotables and slot’s assigned nodes are identical. A `slotchange` event is being fired along the chain of slots, and this is why we can use `slot.assignedNodes({flatten:true})` with the `flatten` option to detect changes to the flattened assigned nodes anywhere along the chain when **assign slotables** happens on the head of the chain (in the root most node tree). Is this described in the docs? -- 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/617
Received on Friday, 16 December 2016 23:36:35 UTC