Closed rafaelw closed 10 years ago
I agree that you should use commas, but we shouldn't confuse object literals with labelled expressions. Just use double brackets for labeled expressions and triple only for object literals which will be more rare.
Labeled expression:
<div class="{{ foo:bar, blaz: bat }}">
Object literal:
<my-class my-attribute="{{{foo:bar, blaz: bat }}}">
Array literal:
<my-class my-items="{{[1,2,true,"foo"]}}">
My naive assumption was that ANY valid JSON expression would also be a valid MDV expression.
Just be clear, I'm suggesting ditching labeled statements in favor of object literals.
In that case, I would still recommend the triple bracket syntax for object literals so that all JSON expressions are valid MDV expressions.
This is now done. We have yet to remove labelled statements: https://github.com/Polymer/polymer-expressions/issues/9, but that will wait on having registration for filters finished and default filters which handle the class/style use-case
e.g. instead of
<div val="{{ foo: bar; blaz: bat; }}">
something like
<div val="{{ { foo: bar, 'blaz': bat } }}">
I think the triple curlies are kinda ugly, but it does make more sense. Also, note all class values are valid identifiers, so this is strictly more correct.