diff --git a/src/standard/effectBuilder.html b/src/standard/effectBuilder.html index 6b1e166a7c..26f5060ddb 100644 --- a/src/standard/effectBuilder.html +++ b/src/standard/effectBuilder.html @@ -168,7 +168,8 @@ // method expressions are of the form: `name([arg1, arg2, .... argn])` _parseMethod: function(expression) { - var m = expression.match(/(\w*)\((.*)\)/); + // tries to match valid javascript property names + var m = expression.match(/([^\s]+)\((.*)\)/); if (m) { var sig = { method: m[1], static: true }; if (m[2].trim()) { diff --git a/test/unit/bind-elements.html b/test/unit/bind-elements.html index 6455059839..8c83dc7863 100644 --- a/test/unit/bind-elements.html +++ b/test/unit/bind-elements.html @@ -17,6 +17,7 @@ custom-event-object-value="{{customEventObject.value::change}}" computed-from-mixed-literals='{{computeFromLiterals(3, "foo", bool)}}' computed-from-pure-literals='{{computeFromLiterals( 3, "foo")}}' + computed-from-tricky-function='{{$computeTrickyFunctionFromLiterals( 3, "foo")}}' computed-from-tricky-literals="{{computeFromTrickyLiterals(3, 'tricky\,\'zot\'')}}" computed-from-tricky-literals2='{{computeFromTrickyLiterals(3,"tricky\,'zot'" )}}' computed-from-no-args="{{computeFromNoArgs( )}}" @@ -223,6 +224,9 @@ assert.equal(str, 'foo'); return num + str; }, + $computeTrickyFunctionFromLiterals: function(num, str) { + return this.computeFromLiterals(num, str); + }, computeFromTrickyLiterals: function(a, b) { return a + b; }, diff --git a/test/unit/bind.html b/test/unit/bind.html index 95108325f9..f0d0cbb5d2 100644 --- a/test/unit/bind.html +++ b/test/unit/bind.html @@ -171,6 +171,7 @@ el.bool = true; assert.equal(el.$.boundChild.computedFromMixedLiterals, '3foo', 'Wrong result from mixed literal arg computation'); assert.equal(el.$.boundChild.computedFromPureLiterals, '3foo', 'Wrong result from pure literal arg computation'); + assert.equal(el.$.boundChild.computedFromTrickyFunction, '3foo', 'Wrong result from tricky function with pure literal arg computation'); assert.equal(el.$.boundChild.computedFromTrickyLiterals, '3tricky,\'zot\'', 'Wrong result from tricky literal arg computation'); assert.equal(el.$.boundChild.computedFromTrickyLiterals2, '3tricky,\'zot\'', 'Wrong result from tricky literal arg computation'); assert.equal(el.$.computedContent.textContent, '3tricky,\'zot\'', 'Wrong textContent from tricky literal arg computation');