0.8 PRIMER.md question

107 views
Skip to first unread message

Artem Khodyush

unread,
Feb 20, 2015, 8:48:48 PM2/20/15
to polym...@googlegroups.com
Hi

I was reading through 0.8 PRIMER.md and I encountered these two statements:


If an attribute matches a property listed in the published object, the attribute value will be assigned to a property of the same name on the element instance


In order to bind to camel-case properties of elements, dash-case should be used in the attribute name. Example:
<user-view first-name="{{managerName}}"></user-view>
<!-- will set <user-view>.firstName = this.managerName; -->

Is this dash-to-camel-case conversion applies uniformly to all assignments to published properties in the element tag? If so, then the first statement should not say "property of the same name", right?

Or does it mean that  <user-view first-name="John">   and   <user-view first-name="{{managerName}}">  are somehow different in this regard?

Thanks,
Artem

Michael Bleigh

unread,
Feb 20, 2015, 8:53:00 PM2/20/15
to polym...@googlegroups.com
I think you're right. The dash-to-camel convention only landed a couple days ago, so it's probably an oversight. https://github.com/Polymer/polymer/commit/68f5ad4bfd34797c1ad90a7133304f76923ac451

Can I just say for the record that I am *extremely thrilled about dash-case attributes*!!! It felt really awful doing camelcase in attributes (esp. since HTML spec says atts are case-insensitive).

One other add-on question: can we do dash-case ids as well? So <div id="my-container"> ends up as $.myContainer? (Assuming the $ convention is still around in 0.8)

Peter Wong

unread,
Feb 20, 2015, 9:17:55 PM2/20/15
to polym...@googlegroups.com
I wonder what the benefits of dash-casing ids would be, as there's nothing stopping you from writing a camelCase id like <div id="myContainer">... right? 
Maybe I'm missing something... :)

Michael Bleigh

unread,
Feb 20, 2015, 9:22:57 PM2/20/15
to polym...@googlegroups.com
No benefit other than I prefer the aesthetics of dash-case for ids :)

Rob Dodson

unread,
Feb 21, 2015, 10:50:54 AM2/21/15
to Michael Bleigh, Kevin Schaaf, polymer-dev
+kschaaf so he sees this. That sounds like a reasonable request, IMO

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/8ae8a21e-324e-4f2b-9439-5b41e3d32e6e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages