Re: [polymer-dev] Add attribute to light dom content

62 views
Skip to first unread message

Eric Bidelman

unread,
Jun 30, 2014, 5:36:53 AM6/30/14
to iale...@gmail.com, polymer-dev
You get can a list of nodes going through an insertion point from getDistributedNodes():

<content id="c"></content>

domReady: function() {
  var nodes = this.$.c.getDistributedNodes();
  for (var i = 0, el; el = nodes[i]; ++i) {
    el.setAttribute('foo', 'bar');
  }
}


BTW, only top-level children are selectable in an insertion point: http://jsbin.com/yeveledi/1/edit




On Sun, Jun 29, 2014 at 3:51 PM, <iale...@gmail.com> wrote:
I have a custom element that uses the select attribute to divide content between two <content> tags within itself. I need one of these to add a attribute to the content first level children. How would I go about this?
Thanks

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/4e734ab9-eb26-4858-b648-f1b29f00f52e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages