Page MenuHomePhabricator

Convert Anchor to ES6 class
Closed, ResolvedPublic


mfExtend() is a prevalent utility in MobileFrontend and MinervaNeue. In the former, ES6 is now available and canonical class extends are preferable to a custom utility. This is a task to continue the work in T220847 by converting Anchor to a class and dropping mfExtend() usage.

Anchor's parent is View and it's slim, so the work should be similar to that done for the BetaOptInPanel.

Acceptance criteria

  • Anchor is a class that extends View.
  • Anchor invokes View with the correct arguments via super.
  • Properties needed during construction by the ancestors, at least View.defaults and View.template, remain on the prototype chain as they did for BetaOptInPanel.
  • mfExtend() is removed and its overrides are moved to class properties and methods.
  • If successful, a new task for further mfExtend() refactors is made. Maybe Button? Maybe something more aggressive that refactors a few tasks at once?

Event Timeline

Niedzielski triaged this task as Medium priority.Jun 4 2019, 3:47 PM
Jdlrobson renamed this task from Convert Anchor to class to Convert Anchor to ES6 class.Aug 6 2019, 2:37 PM
Jdlrobson moved this task from Incoming to Upcoming on the Readers-Web-Backlog board.

Ready to work on (sooner the better) and needs scheduling.

Change 528923 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Anchor is an ES6 class

Jdlrobson added a subscriber: ovasileva.

We were concerned about a performance dip, so we ended up doing this task to show that it wasn't something to be concerned of.

Change 528923 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Anchor is an ES6 class