Accessing <content> contents

64 views
Skip to first unread message

isp...@gmail.com

unread,
Jul 29, 2014, 11:17:07 AM7/29/14
to polym...@googlegroups.com
I'm making a Polymer component to encapsulate some settings. I was thinking one could put anything in the contents of this settings component and it will internally figure out how to turn this into a URL. Settings will be persisted just through GET variables. Settings will be used by other components through regular Polymer databinding.

So I want to iterate over the contents of the component's <content>, looking for HTML inputs, selects, etc. I can't figure out how to do this. I've tried accessing <content> by putting it inside a div, then using this.$.myDiv, and I've also tried accessing the content directly by assigning it an id, using this.$.myContent. In both cases, I can't find any references to the content children. I see a childNodes field with 3 items but none of these look right.

Can someone help me access content or tell me if there is simply a better approach here?

Thanks!

Steve Orvell

unread,
Jul 29, 2014, 12:36:26 PM7/29/14
to isp...@gmail.com, polym...@googlegroups.com
You're looking for the `getDistributedNodes` method on the `<content>` element. It's explained here: 



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/fcf3cc4b-2167-4783-abba-e5a34a713ed4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Bidelman

unread,
Jul 29, 2014, 12:48:11 PM7/29/14
to Steve Orvell, isp...@gmail.com, polym...@googlegroups.com
There's also http://www.polymer-project.org/resources/faq.html#accessContentDOM, which discusses when it's appropriate to first access gDN()


Reply all
Reply to author
Forward
0 new messages