diff options
| author | Michał Gołębiowski | 2013-08-21 11:25:04 +0200 | 
|---|---|---|
| committer | Michał Gołębiowski | 2014-02-26 00:38:37 +0100 | 
| commit | 6b049c74ccc9ee19688bb9bbe504c300e61776dc (patch) | |
| tree | e54c50da99f930823c1550b97a03c065016b713a /src | |
| parent | c99dd224a518ac8c976fe9b22587e4dd2eda78c9 (diff) | |
| download | angular.js-6b049c74ccc9ee19688bb9bbe504c300e61776dc.tar.bz2 | |
feat($parse): support trailing commas in object & array literals
Per ECMAScript 5.1 specification trailing commas are allowed in object and
array literals. All modern browsers as well as IE>8 support this syntax.
This commit adds support for such syntax to Angular expressions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/parse.js | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/src/ng/parse.js b/src/ng/parse.js index bd3aa048..885dc50a 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -785,6 +785,10 @@ Parser.prototype = {      var allConstant = true;      if (this.peekToken().text !== ']') {        do { +        if (this.peek(']')) { +          // Support trailing commas per ES5.1. +          break; +        }          var elementFn = this.expression();          elementFns.push(elementFn);          if (!elementFn.constant) { @@ -811,6 +815,10 @@ Parser.prototype = {      var allConstant = true;      if (this.peekToken().text !== '}') {        do { +        if (this.peek('}')) { +          // Support trailing commas per ES5.1. +          break; +        }          var token = this.expect(),          key = token.string || token.text;          this.consume(':'); | 
