You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
💡 Some implementations of ECMAScript have included additional properties for some of the standard native objects. This non-normative annex suggests uniform semantics for such properties without making the properties or their semantics part of this standard. -- ECMA-262 Edition 5.1 / Annex B / B.2 Additional Properties
String.prototype.substr is optional in ES3 and ES5 but required in ES6. While all browsers appear to have implemented it before the semantics became normative — incorrectly in at least some version(s) of IE — its optional status is not just hypothetical. It's behind a build-time flag in Duktape and missing from e.g. MuJS:
The scripting backend which mpv currently uses is MuJS - a compatible minimal ES5 interpreter. As such, String.substring is implemented for instance, while the common but non-standard String.substr is not. -- mpv manual
Other missing methods that are optional in ES5 and required in ES6 include:
global.escape
global.unescape
Date.prototype.getYear
Date.prototype.setYear
Date.prototype.toGMTString
The text was updated successfully, but these errors were encountered:
The ECMAScript language syntax and semantics defined in this annex are required when the ECMAScript host is a web browser. The content of this annex is normative but optional if the ECMAScript host is not a web browser.
You specifically mention DukTape and MuJS, but these seem perfectly spec compliant to me because they are indeed not "web browser" environments.
So the question is, is it core-js's job to polyfill things that are not required in all ES6 environments. core-js is also used in many non-browser contexts, and it has no 100%-guaranteed way to know whether something is a browser. I could see an argument that these could be implemented as an optional opt-in alongside the normal core-js entry points, but on the other hand the fact that these are optional in some environments means that they should essentially never be used in any code written today.
String.prototype.substr
is optional in ES3 and ES5 but required in ES6. While all browsers appear to have implemented it before the semantics became normative — incorrectly in at least some version(s) of IE — its optional status is not just hypothetical. It's behind a build-time flag in Duktape and missing from e.g. MuJS:Other missing methods that are optional in ES5 and required in ES6 include:
The text was updated successfully, but these errors were encountered: