I have:
When I define the template like this
(insertion points) are for rendering elements in the light DOM at specific locations in the Shadow DOM. Using
says "render any
elements here. If you want all light DOM nodes to be invited into the rendering party, simply use
.
The other issues with your snippet:
The name of the element needs to be defined on
, not as
To get the list of nodes that pass through a
, use content.getDistributedNodes()
. You may also want to consider if you even need
. Light DOM children nodes can be access with .children
and the other accessors. From the Polymer docs:
For a
, you can iterate through
content.getDistributedNodes()
to get the list of nodes distributed at the insertion point.In Polymer, the best place to call this method is in the
attached()
callback so you’re guaranteed that the element is in the DOM tree.Also remember that you can access the light DOM as the element’s normal children (i.e.
this.children
, or other accessors). The difference with this approach is that it’s the entire set of potentially distributed nodes; not those actually distributed.