[w3c/webcomponents] Method for detecting finally-distributed nodes. (#611)

(continuing from https://github.com/w3c/webcomponents/issues/288#issuecomment-263104801)

Currently, `slot.assignedNodes({flatten: true})` doesn't tell the full story; it tells which nodes are distributed to the context slot, but doesn't take into consideration the fact that nodes might be distributed even deeper into the tree of node trees if the context slot is assigned to a deeper slot.

It'd be nice to have a method `distributedNodes()` that answers the question: which nodes are distributed here, i.e. which nodes render relative to this point.

What about an `Element.prototype.distributedNodes` or `HTMLSlotElement.prototype.distributedNodes` that returns children that are distributed to that point, and returns an empty array otherwise? 

Which of the following would make more sense?

1. `slot.distributedNodes()` which returns elements that are finally distributed and render relative tothe slot's parent. (i.e. the slot is not assigned anywhere else, so it is the furthest point where nodes are finally distributed).
1. `el.distributedNodes()` which returns nodes that render relative to `el` (distributed via a child slot element of `el`).

To me, is seems like option 2 is better; elements would have `.children` and `.distributedNodes`

-- 
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/611

Received on Sunday, 27 November 2016 23:17:26 UTC