Re: [w3c/webcomponents] How can a custom element detect when it is transcluded into a shadow tree (slotchange)? (#504)

Ah, oops, I forgot to mention! In the jsbin I posted, the assumption was that the trees were closed, so `motorNode.assignedSlot.parentNode` wouldn't work in that case.

> For closed shadow trees, I don't see how a distributedCallback would help because I assume that in a closed tree, the slotted node should not be able to know about the slot it was distributed to just like you can't access the slot via assignedSlot.

That's true, but with `distributedCallback`, the element *wouldn't know* know about the close-tree slot, because in that case the `slot` argument to `distributedCallback` would be null, but none-the-less the element would still be aware of the distribution action, would be aware that it was distributed, just that it can't access the slot or the inner tree it got composed into. So with `distributedCallback`, an element can still be aware of the fact that it got distributed, even without having access to any data (`slot == null`). It's like if someone took me and blindfolded me then placed me in the trunk of a car, I wouldn't be able to see anything, but I'd still know I was getting distributed to somewhere. 😆 

---
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/504#issuecomment-229939252

Received on Friday, 1 July 2016 12:55:27 UTC