diff --git a/src/parse/read/directives.js b/src/parse/read/directives.js index a52cbfabba..28adc3078a 100644 --- a/src/parse/read/directives.js +++ b/src/parse/read/directives.js @@ -77,6 +77,17 @@ export function readBindingDirective ( parser, start, name ) { const a = parser.index; + if ( parser.eat( '{{' ) ) { + let message = 'bound values should not be wrapped'; + const b = parser.template.indexOf( '}}', a ); + if ( b !== -1 ) { + const value = parser.template.slice( parser.index, b ); + message += ` — use '${value}', not '{{${value}}}'`; + } + + parser.error( message, a ); + } + // this is a bit of a hack so that we can give Acorn something parseable let b; if ( quoteMark ) { diff --git a/test/parser/samples/error-binding-mustaches/error.json b/test/parser/samples/error-binding-mustaches/error.json new file mode 100644 index 0000000000..9d67bfba1a --- /dev/null +++ b/test/parser/samples/error-binding-mustaches/error.json @@ -0,0 +1,8 @@ +{ + "message": "bound values should not be wrapped — use 'foo', not '{{foo}}'", + "loc": { + "line": 1, + "column": 19 + }, + "pos": 19 +} \ No newline at end of file diff --git a/test/parser/samples/error-binding-mustaches/input.html b/test/parser/samples/error-binding-mustaches/input.html new file mode 100644 index 0000000000..a334ea7055 --- /dev/null +++ b/test/parser/samples/error-binding-mustaches/input.html @@ -0,0 +1 @@ +