Merge pull request #3350 from TimvdLippe/fix-binding-with-dash

Fix bindings with special characters
This commit is contained in:
Daniel Freedman 2016-02-17 15:44:40 -08:00
commit 49d04b0dd7
3 changed files with 12 additions and 1 deletions

View File

@ -90,7 +90,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
_bindingRegex: (function() {
var IDENT = '(?:' + '[a-zA-Z_$][\\w.:$-*]*' + ')';
var IDENT = '(?:' + '[a-zA-Z_$][\\w.:$\\-*]*' + ')';
var NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')';
var SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')';
var DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')';

View File

@ -55,6 +55,7 @@
<div id="compound2">
literal1 {{cpnd1}} literal2 {{cpnd2}}{{cpnd3.prop}} literal3 {{computeCompound(cpnd4, cpnd5, 'literal')}} literal4
</div>
<span id="boundWithDash">{{objectWithDash.binding-with-dash}}</span>
</template>
<script>
Polymer({
@ -134,6 +135,9 @@
},
noComputedProp: {
computed: 'foobared(noComputed)'
},
objectWithDash: {
type: Object
}
},
observers: [

View File

@ -279,6 +279,13 @@ suite('single-element binding effects', function() {
assert.equal(el.$.boundChild.computedWildcard, 15);
});
test('binding with dash', function() {
el.objectWithDash = {
'binding-with-dash': 'yes'
};
assert.equal(el.$.boundWithDash.textContent, 'yes');
})
});
</script>