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

@hayatoito If a method like `slot.distributedNodes()` returns an empty array, it doesn't reveal the structure of the closed tree. The empty array result only means one of two possible things:

1. Either no nodes were distributed from the parent light tree to the current tree
1. or nodes have been distributed into a child tree.

This is no more revealing than `slot.assignedNodes`.

Having a way to get finally-distributed nodes is important for libraries like [A-Frame](http://aframe.io) if you wish for such libraries to promote ShadowDOM by being ShadowDOM-compatible. Libraries like that -- which render to WebGL or somewhere outside of DOM rendering -- need to be able to determine final-distribution of nodes in order to know how to render things.

If the platform doesn't have such a feature, then library authors (who are willing to take the time) will  have to spend time coming up with a hack in order to achieve this with closed trees. Libraries will contain uglier code.

On the other hand, it would be nice for a library author to simply call something like `slot.distributedNodes()` to make life easy; and it doesn't reveal the closed tree structure.

Plus, as you know, ShadowDOM is not a security feature. It can be hacked to achieve this, but it's ugly that it has to be done.

I believe that for *most cases* -- for libraries that rely on DOM rendering -- this isn't an issue. But for libraries that need to know final-distribution (i.e. know flat the flat tree), closed trees are a temporary road block. Having something like `slot.distributedNodes()` is only going to make easier what we're already going to do as library authors.

Here is a list of libraries that (I believe) would benefit from such a feature if they want to be ShadowDOM-compatible:

- [A-Frame](https://customelements.io/aframevr/aframe/)
  - ShadowDOM-compatible: **no**
- [three-canvas](https://customelements.io/technohippy/three-canvas/)
  - ShadowDOM-compatible: **no**
- (Construct.js](https://customelements.io/constructjs/construct/) (See [HTML sample](https://github.com/constructjs/construct/blob/master/examples/side-scroller.html#L49-L77))
  - ShadowDOM-compatible: **no**
- [webVR Markup](https://customelements.io/VRcollab/webvr-markup/)
  - ShadowDOM-compatible: **no**
- [GLAM](https://tparisi.github.io/glam/)
  - ShadowDOM-compatible: **no**
- [x3dom](http://www.x3dom.org/)
  - ShadowDOM-compatible: **no**
- [Infamous](https://github.com/trusktr/infamous)
  - ShadowDOM-compatible: **soon**

-- 
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#issuecomment-263194767

Received on Monday, 28 November 2016 06:42:20 UTC