Skip to content

Commit 7027674

Browse files
committed
fix(compiler): fix a typo in BIND_NAME_REGEXP
1 parent 4500888 commit 7027674

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/core/src/compiler/pipeline/property_binding_parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {CompileControl} from './compile_control';
1111
import {interpolationToExpression} from './text_interpolation_parser';
1212

1313
// TODO(tbosch): Cannot make this const/final right now because of the transpiler...
14-
var BIND_NAME_REGEXP = RegExpWrapper.create('^(?:(?:(bind)|(let)|(on))-(.+))|\\[([^\\]]+)\\]|\\(([^\\]]+)\\)');
14+
var BIND_NAME_REGEXP = RegExpWrapper.create('^(?:(?:(bind)|(let)|(on))-(.+))|\\[([^\\]]+)\\]|\\(([^\\)]+)\\)');
1515

1616
/**
1717
* Parses the property bindings on a single element.

modules/core/test/compiler/pipeline/property_binding_parser_spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ export function main() {
4343
it('should detect () syntax', () => {
4444
var results = createPipeline().process(createElement('<div (click)="b()"></div>'));
4545
expect(MapWrapper.get(results[0].eventBindings, 'click').source).toEqual('b()');
46+
// "(click[])" is not an expected syntax and is only used to validate the regexp
47+
results = createPipeline().process(createElement('<div (click[])="b()"></div>'));
48+
expect(MapWrapper.get(results[0].eventBindings, 'click[]').source).toEqual('b()');
49+
4650
});
4751

4852
it('should detect on- syntax', () => {

0 commit comments

Comments
 (0)