Page MenuHomePhabricator

Provide a polyfill for ES2019 Object.fromEntries
Open, Needs TriagePublic

Description

Brought up as a part of discussion in a patch here following the pattern of web2017-polyfills module of MediaWiki, perhaps we can have a polyfill for Object.fromEntries, perhaps as a part of a new module called 'web2019-polyfills' (?) that could contain implementation of core-js or this Object.fromEntries's polyfill.

This feature is supported since Chrome 73, Firefox 63 and Safari 12.1.

See also: T357197#9531203

Event Timeline

Ebrahim updated the task description. (Show Details)
Krinkle renamed this task from Provide a polyfill for Object.fromEntries to Provide a polyfill for ES2017 Object.fromEntries.Jan 4 2025, 9:55 PM
Krinkle edited projects, added MediaWiki-ResourceLoader; removed MediaWiki-General.

Brought up as a part of discussion in a patch here following the pattern of web2017-polyfills module of MediaWiki, perhaps we can have a polyfill for Object.fromEntries, perhaps as a part of a new module called 'web2019-polyfills' (?) that could contain implementation of core-js or this Object.fromEntries's polyfill.

web2017-polyfills is for Web Platform APIs (DOM, Selector, HTML, Storage, Performance, Fetch, URL, etc).

The method you're describing is part of the language runtime (JavaScript, ES2017). We've had polyfill modules like this previously for es5 and es6, and could for example ship a es2017-polyfill module (with appropriate skipFunction).

Note that this would be obsolete after T381537: Raise Grade A JavaScript requirement from ES2016 (ES7) to ES2017 (ES8).

Note that this would be obsolete after T381537

The web2017-polyfill currently contains four scripts/polyfills:

  • IntersectionObserver - feature added in Safari 12.1 and iOS 12.2 and current grade A is Safari 11.1 and iOS 11.3.
  • fetch - this polyfill is now redundant and can be removed.
  • URL - also redundant and can be removed.
  • URL.toJSON - requires Chrome 71

So to drop web2017-polyfills we need to add IntersectionObserver and URL.toJSON fo startup tests.

SD0001 renamed this task from Provide a polyfill for ES2017 Object.fromEntries to Provide a polyfill for ES2019 Object.fromEntries.Jan 12 2025, 2:36 PM
SD0001 subscribed.

Object.fromEntries is from ES2019.