Is there a way to programmatically distribute (insert) content from lightDOM to ShadowDOM?
I would like to wrap every single child node into an element. For example :
Composition is something Shadow DOM is designed for. If that spec bug gets fixed, the best way to do this would be interesting tricks with
in a . Since you can't (currently) use
:nth-child
, you could instead use the distributed nodes and data-binding to wrap the content:
-
nodes
is generated from something like:
this.nodes = Array.prototype.slice.call(this.$.c.getDistributedNodes());
I'm using
from this post: https://stackoverflow.com/a/22208332/274673
Working demo: http://jsbin.com/mamawugo/2/edit