ECMAScript 6 Supported Syntax

Ajax Minifier version 5 supports a subset of new ECMAScript 6 syntax. If any of the below syntax doesn’t minify properly, please file an issue on the AjaxMin Codeplex website. Also keep in mind that the ES6 specification is still a proposal – it has not been finalized yet, and is still open to change. I’ve been working from specification drafts on the ECMAScript.org website. Please also report any out-of-date ES6 implementations in AjaxMin.

  • Surrogate pair escapes in string literals (Section 6.1.4)
  • Octal and binary numeric literals (Section 11.8.3)
  • Extended Unicode escape sequences (Section 11.8.4)
  • Spread operators in array literals (Section 12.1.4.1)
  • Array comprehensions (Section 12.1.4.2)
  • Implicit object literal field names (Section 12.1.5)
  • Generator comprehensions (Section 12.1.7)
  • Template literals (Section 12.1.9)
  • Spread operators in call syntax (12.2)
  • Super keyword (Section 12.2.4)
  • Destructuring assignments (Section 12.13.3)
  • Lexical declarations (let/const) (Section 13.2.1)
  • Destructuring binding patterns (Section 13.2.3)
  • For..of statements (Section 13.6.4)
  • Default function parameter values (Section 14.1)
  • Rest parameters (Section 14.1)
  • Arrow Functions (Section 14.2)
  • Object literal methods (Section 14.3)
  • Generator function declarations (Section 14.4)
  • Class Definitions (Section 14.5)
  • Modules (Section 15.3)
  • Block-level function declaration scope (Section B.3.2)

 

By default, AjaxMin will begin parsing the input source code as ECMAScript 5 syntax, but will switch to ES6 if it encounters something that it knows is ES6-only. You can use the -js:es6 switch on the command-line to force ES6 parsing from the beginning. For those using the library objects directly from the DLL, the CodeSettings.ScriptVersion property is set to ScriptVersion.None by default; you can set it to ScriptVersion.EcmaScript6 to force ES6 parsing. After parsing source code, you can check the JSParser.ParsedVersion property to see if any ES6 syntax was encountered.

Last edited Sep 12, 2013 at 10:16 PM by ronlo, version 3

Comments

No comments yet.