es-shims / es7-shim

ECMAScript 7 compatibility shims for legacy JavaScript engines
MIT License
173 stars 32 forks source link

mongolian vowel separator #53

Open SheetJSDev opened 6 years ago

SheetJSDev commented 6 years ago

There was a backwards-incompatible change in ES7 corresponding to whitespace, as the Unicode version pin was removed:

https://www.ecma-international.org/ecma-262/6.0/#sec-white-space

ECMAScript implementations must recognize as WhiteSpace code points listed in the “Separator, space” (Zs) category by Unicode 5.1.

https://www.ecma-international.org/ecma-262/7.0/#sec-white-space

ECMAScript implementations must recognize as WhiteSpace code points listed in the “Separator, space” (Zs) category.

The MONGOLIAN VOWEL SEPARATOR U+180E used to be in Zs but was moved to Cf in Unicode 6.3.0. ES7 mandates Unicode 8.0.0 or higher. As a result, whitespace-sensitive methods will behave differently.

For example, consider "\u180e".trim().length. An ES6-compatible browser like Safari 11 will remove the character, yielding a length of 0. However, an ES7-compatible engine should not remove the character, yielding a length of 1.

String#trim and other methods that lean on whitespace are affected.

ljharb commented 5 years ago

https://github.com/tc39/ecma262/pull/1698 corrects this omission in the spec's Annex E.