Page MenuHomePhabricator

Add polyfill for ES6 array methods to improve experience in Internet Explorer
Closed, ResolvedPublic

Description

MediaSearch as a feature is committed to functioning in IE11. However, we rely on a couple of features in JS that are not supported by that browser and need to be polyfilled or at least tested for.

Must be polyfilled

  • Array.prototype.find
  • Array.prototype.findIndex

May not be present but can be worked around

  • Intersection Observer
  • HTMLImageElement.decode (in init.js file for "hydration")

Current Status

  • The array method polyfills are manually vendored in MediaSearch, but this means that they get shipped to all users, including the vast majority who don't need them. Fortunately they are each pretty small.
  • The Observer component and the init.js file both contain tests for necessary browser features, so we don't need to add new polyfills here.

To Do

  • See if we can add polyfills for the array methods here into MediaWiki core (similar to how Promise is handled), so that we don't need to ship this code to users who do not need it. Additionally, other MW developers will gain the ability to rely on these useful Array methods in their own code.

Event Timeline

Assigning to Eric to add a subtask for the polyfills, which will require some time and discussion.

CBogen renamed this task from Improve experience in Internet Explorer to Implement polyfills to improve experience in Internet Explorer.Oct 21 2020, 4:42 PM
CBogen renamed this task from Implement polyfills to improve experience in Internet Explorer to Determine how to manage polyfills to improve experience in Internet Explorer.
CBogen updated the task description. (Show Details)

Picking this one back up as one of our remaining "to dos" for the project. Hoping we can add some of these to MW core so everyone benefits.

Change 679012 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Add polyfills for ES6 array methods

https://gerrit.wikimedia.org/r/679012

Change 681504 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] es6-polyfills: Merge "es6-promise" into "es6-polyfills"

https://gerrit.wikimedia.org/r/681504

Change 681506 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/WikiLambda@master] Switch use of "es6-promise" to "es6-polyfills"

https://gerrit.wikimedia.org/r/681506

Change 681507 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] es6-polyfills: Remove deprecated alias "es6-promise"

https://gerrit.wikimedia.org/r/681507

Krinkle renamed this task from Determine how to manage polyfills to improve experience in Internet Explorer to Add polyfill for ES6 array methods to improve experience in Internet Explorer.Apr 21 2021, 2:21 AM

Change 679012 merged by jenkins-bot:

[mediawiki/core@master] Add polyfills for ES6 array methods

https://gerrit.wikimedia.org/r/679012

Change 681504 merged by jenkins-bot:

[mediawiki/core@master] es6-polyfills: Merge "es6-promise" into "es6-polyfills"

https://gerrit.wikimedia.org/r/681504

Change 681506 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Switch use of "es6-promise" to "es6-polyfills"

https://gerrit.wikimedia.org/r/681506

Change 681507 merged by jenkins-bot:

[mediawiki/core@master] es6-polyfills: Remove deprecated alias "es6-promise"

https://gerrit.wikimedia.org/r/681507

Next step is to have MediaSearch switch to use the ones in core, I presume?

Next step is to have MediaSearch switch to use the ones in core, I presume?

Yes – I'll create a new follow-up task for that.