Extension:MobileFrontend/Remove existing HTMLFormatter code from MobileFrontend extension

From mediawiki.org

Current Situation[edit]

The mobile site currently does various hacks which have resulted in various bugs being reported.

  1. Removes elements: Things like the table of contents and any element with the nomobile class. There are various other special cases.
  2. Replaces images with alt text for users who have slow connections and have opted in
    1. Side note: we should test the usage of this
  3. Wraps sections in DIVs. This allows us to identify parts of the document and style them appropriately and also allows us to enable toggling of entire sections.
  4. Flatten elements. e.g. red links. Since page creation is difficult on some projects on desktop let alone mobile we convert these to spans

Motivations for removing HTMLFormatter code and possibly migrating remaining MobileFrontend logic to core[edit]

  • Reduce regressions - there have been several cases where changes to HTML have had a serious implication on mobile. For example, a change in the class name of the edit buttons in section headings resulted in a high volume of anonymous edits on mobile, many of which were spam which we had to fire fight.
  • It is not sustainable. We scrub unsuitable elements in the HTML output and as a result we've had issues where edit links have shown up in sections due to HTML changes
  • Reduce code complexity: The code is a mess and a nightmare to maintain/navigate - we currently resort to a regular expression in order to have collapsible sections.
  • Performance - we shouldn't need to DOMParse the entire HTML output before rendering - we should be able to ask the parser to do these things. For example, in various places we rewrite absolute URLs to be https and use the mobile site.
  • We would like our mobile skin to work on both desktop and mobile to encourage more development effort from outside teams which currently see the existing skin as a confusing black box
  • Sharing functionality - for example we currently disable images on mobile. It would nice to share this code with users who would like to disable images on desktop.

Outcomes[edit]

  1. MobileFrontend would become a skin that would appear in user preferences. This would lead the way towards mobile being better integrated with core.
  2. It is understood that this will make integration with VisualEditor easier, although not 100% clear how.