There are no official guidelines. I think for the most part it's a style thing, and at the moment what you see in the docs may depend on who first wrote the example. There are two basic schools of thought:
School #1) Curly braces are "automatic" -- in almost all cases, they just do the right thing. Use 'em everywhere unless you specifically want to rule out the possibility of a two-way binding. (You'll see that a lot of the docs are written this way, partly for historical reasons -- 0.5 had only the curly brackets.) School #2) Using square braces for all one-way bindings makes it easy to see the expected data flow. So use square brackets everywhere and only use curly brackets where you specifically want a two-way binding. (Most of the new elements follow this style.) I'm not aware of big performance implications either way. I'd say pick your style and stick to it. Cheers, Arthur On Fri, May 15, 2015 at 2:57 PM, <[email protected]> wrote: > Is there a guideline for when to use curly vs. square braces, when the > effect would be the same? > > For example PRIMER.md uses curly braces for text content, but it's just a > one-way binding: > > <span>{{first}}</span> > > Computed bindings are another example. PRIMER.md uses curly braces, which > seems confusing because it's not really two-way binding: > > <x-child some-property="{{getValue(otherThing)}}"> > > Finally in one-way downward binding (notify: true is not set on a > property), using curly braces won't result in the host property being > updated. > > Are there any performance reasons to use one or the other? Or suggested > style or forward-compatibility reasons? > > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/polymer-dev/fdb138e1-dc82-420a-9d10-ec0d55a715cc%40googlegroups.com > <https://groups.google.com/d/msgid/polymer-dev/fdb138e1-dc82-420a-9d10-ec0d55a715cc%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CADSbU_xM2d%3Db54W-NNXv7hi2D27pL%2BrFVrL5BaFy_U-u7UuUZw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
