Page MenuHomePhabricator

Explore native support for ES2016 (ES7) or higher versions
Open, LowPublic


Now that we have done T272104: Allow modules to opt-in to ES6 syntax support, we should consider doing the same thing for ES2016, ES2017, or whatever version makes sense.

We will have to consider the benefits of new language features in a given ES version versus the costs of dropping browsers that don't support it, and the complexity of feature detection.

Notable features in new versions:

  • ES2016: nothing spectacular (just Array.prototype.includes and the ** operator)
  • ES2017: async functions, Object.values()/Object.entries(), padStart()/padEnd() for strings (+ shared memory features that were disabled for a while due to security challenges)
  • ES2018: async iteration (for await), spread (...) in object literals, Promise.finally(), regex features (named capture groups, lookbehind, /s flag, \p{...})
  • ES2019: optional catch binding, flat()/flatMap() for arrays, trimStart()/trimEnd() for strings, Object.fromEntries()
  • ES2020: ?? and ?. operators, dynamic import, import.meta, export * as Foo from 'bar', BigInt, matchAll(), globalThis, Promise.allSettled()

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Catrope updated the task description. (Show Details)

I haven't yet looked at which browsers support these features and how well-used they are. That information should be added to this task next. I don't have time to do that right now; anyone else should feel free to pick that up.

Krinkle moved this task from Inbox to Backlog on the MediaWiki-ResourceLoader board.
Krinkle added a subscriber: Krinkle.

Lowering priority for now this is not purely a backend enhancement, it's a product decision impacting browser support. That decision will inform when resourcing for this is needed.

Note that this task is purely about syntax sugar, not methods and APIs. APIs for Array and Object methods etc can and should be skip-loaded polyfilled, the same as with any other Web APIs (e.g. those not part of the ES spec).