Page MenuHomePhabricator

Remove unused core JavaScript modules that ship with MediaWiki core (May 2023)
Closed, ResolvedPublic

Description

Background

There are a dozen or so modules in core that are unused, and also lack any owner. There is no big problem with any one of these, nor would it be worth the proportionate work to remove a single of these only. This task will attempt to sharing and multiplying the impact by doing several in a batch. If one or two of these end up still needed, it'd be fine to simply keep them as-is and move on. The idea is to shake the tree a little and see what's uncontroversial to remove.

Outcome

  • Reduce Size of the startup manifest.
  • Reduce overhead from busywork (style updates, deprecation churn, search results, etc) for code that isn't actually being used.

Proposal

  • Remove jquery.color. Pure logic, copied from upstream in 2007, no known issues or need for updates.

It's usually graceful to remove if it's only used for the implicit change to animation effects. Check for colorUtil references for procedural dependence.

It's effectively a vendor-prefix polyfill, which I imagine is largely if not entirely obsolete by now. The caller should be updated to listen to the relevant event directly using plain jQuery core or DOM directly.

Historically, this was often not used for its ajax purpose, but rather for its formSerialize() utility which is just 2 lines stable and inline-able jQuery code nowadays that we can put into a handful of places directly against the jQuery API rather than through this module. If methods like ajaxSubmit() or ajaxForm() are used, that indicates significant dependence. In that case we may want to reconsider and either keep or e.g. move to a hidden gadget in its entirely to load on-wiki.

Event Timeline

Krinkle renamed this task from Remove unused core JavaScript modules that ship with MediaWiki core to Remove unused core JavaScript modules that ship with MediaWiki core (May 2023).May 4 2023, 11:30 PM
Krinkle moved this task from Inbox to Accepted Enhancement on the MediaWiki-ResourceLoader board.
Krinkle raised the priority of this task from Low to Medium.Sep 11 2023, 1:24 PM

Change 959889 had a related patch set uploaded (by Hokwelum; author: Hokwelum):

[mediawiki/extensions/MultimediaViewer@master] Remove unused core JavaScript modules that ship with MediaWiki core

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

Change 959889 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] Remove unused core JavaScript modules that ship with MediaWiki core

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

We can't remove jquery.form from TranslateSvg Extension because it has been archived, see T331817!

@Hokwelum: I'd recommend to edit the task description in that case, to update the current situation

@Hokwelum: I'd recommend to edit the task description in that case, to update the current situation

Done! Now, we are only removing the references in Mediawiki core:-)

Change 964085 had a related patch set uploaded (by Hokwelum; author: Hokwelum):

[mediawiki/core@master] Remove unused core JavaScript modules that ship with MediaWiki core

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

@Jack_who_built_the_house Hi! Several of the search results for jquery.color usage are copies of convenientDiscussions.js.

The canonical version (on Commons, and on your GitHub) no longer uses it, and the 2022 commit that removes it, suggests it wasn't used programmatically or functionallly relied upon through $.colorUtil but rather only for enhancing animations. Based on cursory testing, it seems that jQuery animate() does not fallback to css() for properties that can't animate, rather it ignores the property. This means, I think, that we'd need to change the relevant animate() call partially to css() to remove the animation. Or we can fully load jquery.ui as you did.

Would you mind going through some of these and/or recommending an edit I can make to those pages?

@Krinkle Thank you for caring enough to look into old copies of my script, haha. The majority of the results are not used by anyone. Those in my userspace are kept for historical purposes. I already requested removal of some of them. If they interfere with your cleaning up routines, I can remove all or most versions that are not in use.

As for the rest, I would suggest replacing with jquery.ui as the easier option preserving the functionality. The only properties I animate are backgroundColor, opacity, and scrollTop.

Change 964085 merged by jenkins-bot:

[mediawiki/core@master] resources: Remove jquery.color, jquery.fullscreen, and jquery.form

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