Extension:MobileFrontend/Remove existing HTMLFormatter code from MobileFrontend extension
Current Situation
editThe mobile site currently does various hacks which have resulted in various bugs being reported.
- Removes elements: Things like the table of contents and any element with the nomobile class. There are various other special cases.
- Replaces images with alt text for users who have slow connections and have opted in
- Side note: we should test the usage of this
- 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.
- 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.
- The following bugs for example:
- https://bugzilla.wikimedia.org/show_bug.cgi?id=48551
- https://bugzilla.wikimedia.org/show_bug.cgi?id=48730
- https://bugzilla.wikimedia.org/show_bug.cgi?id=50530
- https://bugzilla.wikimedia.org/show_bug.cgi?id=51991
- https://bugzilla.wikimedia.org/show_bug.cgi?id=52857
- https://bugzilla.wikimedia.org/show_bug.cgi?id=52858
- The following bugs for example:
- 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- MobileFrontend would become a skin that would appear in user preferences. This would lead the way towards mobile being better integrated with core.
- It is understood that this will make integration with VisualEditor easier, although not 100% clear how.