Noob questions on using Polymer

147 views
Skip to first unread message

Srinarasi

unread,
Sep 17, 2013, 7:02:36 AM9/17/13
to polym...@googlegroups.com
Hi,

I just started experimenting with Web Components and I have a couple of questions.

1) In Sandbox, to bind an attribute of an element to another, it uses the "this.$." object. How do I achieve the same when there is no top level element like the <tk-app> in Sandbox and I just have a few polymer-elements inside the <body>? If I have to keep the markup as readable as the Sandbox app ("$._id_.property" is extremely simple and I love it), do I need to attach a $ object to body and maintain it myself?

2) I was trying to make a Mozilla Brick element talk to a polymer element but if I include polymer and brick.js in the same file, I get an exception in "deprecated.js". All I've done is to include both .js files in the head. What might be the issue here?






















Finally, thank you very much for developing this toolkit. It looks very promising.
Cheers!
Bhargava

Benjamin Howe

unread,
Sep 17, 2013, 2:56:58 PM9/17/13
to polym...@googlegroups.com
Not sure I completely understand what you're after, but if you want the $._id_ magic to work outside a polymer element then yes, you would have to manage that yourself.  It's not complicated, see marshalNodeReferences in https://github.com/Polymer/polymer/blob/master/src/instance/base.js to see how Polymer does it.  You could even use mutation observers to keep the object up to date, but at that point you're probably better off just using jQuery or querySelector('#id').

-Benjamin

Daniel Freedman

unread,
Sep 17, 2013, 6:19:56 PM9/17/13
to polym...@googlegroups.com
Not sure what's going on in #2. I'm investigating this now.

BTW, thanks for pointing out that the sourcemaps for polymer are indicating the wrong files in exceptions. Just fixed in grunt step, should be fixed by next release.

Daniel Freedman

unread,
Sep 17, 2013, 6:23:07 PM9/17/13
to polym...@googlegroups.com
Can you post a jsfiddle of your setup? I'm having trouble reproducing this.

Bhargava Srinarasi

unread,
Sep 18, 2013, 11:06:56 AM9/18/13
to Daniel Freedman, polym...@googlegroups.com
Thanks Benjamin. I'll take a look.

Daniel, here's the jsbin link. http://jsbin.com/ehakeCu/1 If I remove my HTML import I don't get any error. Am I missing something basic?




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.
For more options, visit https://groups.google.com/groups/opt_out.



--

Daniel Freedman

unread,
Sep 18, 2013, 2:13:33 PM9/18/13
to Bhargava Srinarasi, polymer-dev
It looks like there's some fundamental problem with the way Brick and Polymer load (the same) Custom Elements polyfill. They stamp over each other and a whole bunch of errors happen on load.

We'll reach out to the X-tags team soon to hash out this scenario, but for now it seems that they are incompatible :(.

Addy Osmani

unread,
Sep 23, 2013, 6:17:25 AM9/23/13
to polym...@googlegroups.com, Bhargava Srinarasi
I imagine this is a problem we'll run into increasingly in the future as more frameworks start to use the same polyfills as a base. Do we support a no-conflict mode in any of the Polymer polyfills at present?

Eric Bidelman

unread,
Sep 23, 2013, 12:43:07 PM9/23/13
to Addy Osmani, Bhargava Srinarasi, polymer-dev

Please file a bug!

Daniel Freedman

unread,
Oct 2, 2013, 2:47:28 PM10/2/13
to Eric Bidelman, Addy Osmani, Bhargava Srinarasi, polymer-dev
FYI, here's the bug for this: https://github.com/Polymer/platform/issues/39. Workaround for now is to just use the x-tags core file.
Reply all
Reply to author
Forward
0 new messages