Access the content of <content></content> with dart

352 views
Skip to first unread message

Marcelo Mayor

unread,
Jan 17, 2014, 3:10:45 PM1/17/14
to polym...@googlegroups.com
Hello:  supose I we have:

    <html>
       <head> .... </head>
        <body>
             .
             .
             <custom-element>
                 <div><p> Hello Word!</p></div>
             </custom-element>
             .
             .
        </body>
    </html>

     In polymer element definition I push a <content></content> tag for render the children nodes of <custom-element> in html. How I can access to content of <content> in the script or class in Dart?? Thanks.

      

Eric Bidelman

unread,
Jan 17, 2014, 3:15:56 PM1/17/14
to Marcelo Mayor, polymer-dev
In JS, content.getDistributedNodes() will return a NodeList of elements passing through the insertion point:


If there's not a direct equivalent in Dart, I'd ask on their list.



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/e9edaaeb-d675-407c-a4e9-aeb2fe06619a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Seth Ladd

unread,
Jan 17, 2014, 4:04:45 PM1/17/14
to Eric Bidelman, Marcelo Mayor, polymer-dev
And here's the Dart equivalent: https://api.dartlang.org/docs/channels/stable/latest/dart_html/ContentElement.html#getDistributedNodes  (In the Dart case, it returns a List<Node>, but pretty close to the same thing)


Marcelo Mayor

unread,
Jan 17, 2014, 6:49:13 PM1/17/14
to polym...@googlegroups.com

Thanks. This problem is solved. Now the problem is that I can't cast the Node (List<Node> getDistributdNodes()) to

a polymer-element. Get a list of content items (ContentElement.children) gives an empty list.

I have tried many ways and nothing works. How cast it ?? Node to extended polymer class???

Thanks.

Seth Ladd

unread,
Jan 17, 2014, 6:50:42 PM1/17/14
to Marcelo Mayor, polymer-dev
Hi Marcelo,

Can you email w...@dartlang.org , or better yet post your question (with code samples) to StackOverflow ? That way, more Dart developers can help you solve the issue.

Thanks!
Seth



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.
Reply all
Reply to author
Forward
0 new messages