⚓ T341775 Discourage, deprecate and stop using Xml methods for building HTML markup
Page MenuHomePhabricator

Discourage, deprecate and stop using Xml methods for building HTML markup
Open, Needs TriagePublic

Assigned To
None
Authored By
Lucas_Werkmeister_WMDE
Jul 13 2023, 10:13 AM
Referenced Files
None
Tokens
"Like" token, awarded by Volker_E."Love" token, awarded by Ladsgroup."Like" token, awarded by Daimona."Like" token, awarded by Jdlrobson."Mountain of Wealth" token, awarded by Mainframe98.

Description

MediaWiki has two PHP classes that can be used for building HTML markup for browsers: Html, and Xml. Some methods are very similar between the two (e.g. Html::element( 'x', [ 'y' => 1 ], 'z' ) === Xml::element( 'x', [ 'y' => 1 ], 'z' )), though the Xml versions sometimes have fewer features (e.g. only Html supports 'class' => [ 'foo', 'bar' ] attribute array values). Some methods are only available in one of the two classes, possibly for no good reason other than historical accident. (For instance, fieldset() is only in Xml, while hidden() is only in Html.)

This is generally confusing, no longer necessary since the HTML5ication of MediaWiki years ago, and occasionally leads to bugs (e.g. T341566). We should stop using the Xml methods that are used for building HTML (as opposed to the ones for general-purpose XML, for example in Special:Export or RSS, which of course should be kept). Some methods may need to be copied to Html if they’re not available there yet.

A codesearch for Xml:: reveals 218 files across 38 repos.

Details

SubjectRepoBranchLines +/-
mediawiki/extensions/CentralNoticewmf_deploy+0 -0
mediawiki/extensions/UserGroupsmaster+22 -27
mediawiki/extensions/CentralNoticemaster+68 -67
mediawiki/extensions/PDFEmbedmaster+3 -2
mediawiki/extensions/SubpageNavigationmaster+17 -15
mediawiki/extensions/MassEditRegexmaster+41 -65
mediawiki/extensions/WikimediaIncubatormaster+24 -23
mediawiki/extensions/BibManagermaster+11 -10
mediawiki/extensions/InputBoxmaster+28 -29
mediawiki/extensions/CentralNoticemaster+377 -362
mediawiki/extensions/SiteMatrixmaster+9 -10
mediawiki/extensions/CentralNoticemaster+121 -112
mediawiki/extensions/Scribuntomaster+1 -2
mediawiki/extensions/Mathmaster+24 -28
mediawiki/extensions/CirrusSearchmaster+1 -2
mediawiki/extensions/Echomaster+16 -21
mediawiki/extensions/Collectionmaster+22 -22
mediawiki/extensions/Nukemaster+3 -3
mediawiki/coremaster+34 -3
Show related patches Customize query in gerrit

Event Timeline

Change 1004041 had a related patch set uploaded (by Jforrester; author: Thiemo Kreuz (WMDE)):

[mediawiki/core@master] Soft deprecate many Xml methods that belong to Html, not Xml

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

Change 1004041 merged by jenkins-bot:

[mediawiki/core@master] Soft deprecate many Xml methods that belong to Html, not Xml

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

Change #1021914 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Nuke@master] Replace trivial Xml::… methods with Html::…

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

Change #1021962 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/CentralNotice@master] Replace a lot of more trivial Xml::… calls with Html::…

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

Change #1021914 merged by jenkins-bot:

[mediawiki/extensions/Nuke@master] Replace trivial Xml::… methods with Html::…

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

Change #1022131 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Collection@master] Convert extension to not use the Xml class any more

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

Change #1022136 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Echo@master] Stop using the Xml class in this codebase

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

Change #1022131 merged by jenkins-bot:

[mediawiki/extensions/Collection@master] Convert extension to not use the Xml class any more

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

Change #1022153 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Math@master] Stop using the Xml class in this codebase

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

Change #1022136 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Stop using the Xml class in this codebase

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

Change #1021962 merged by jenkins-bot:

[mediawiki/extensions/CentralNotice@master] Replace a lot of more trivial Xml::… calls with Html::…

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

Change #1024619 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/CirrusSearch@master] Stop using the Xml class in this codebase

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

Change #1024628 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/SiteMatrix@master] Stop using the Xml class in this codebase

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

Change #1024629 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Scribunto@master] Stop using the Xml class in this codebase

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

Change #1024664 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/CentralNotice@master] Replace all Xml::tags calls with Html::rawElement

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

Change #1024628 merged by jenkins-bot:

[mediawiki/extensions/SiteMatrix@master] Stop using the Xml class in this codebase

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

Change #1024619 merged by jenkins-bot:

[mediawiki/extensions/CirrusSearch@master] Stop using the Xml class in this codebase

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

Change #1022153 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Stop using the Xml class in this codebase

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

Change #1024629 merged by jenkins-bot:

[mediawiki/extensions/Scribunto@master] Stop using the Xml class in this codebase

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

Change #1024664 merged by jenkins-bot:

[mediawiki/extensions/CentralNotice@master] Replace all Xml::tags calls with Html::rawElement

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

Change #1025290 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/CentralNotice@master] Replace more Xml::… methods with Html::… equivalents

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

Change #1025304 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/SubpageNavigation@master] Stop using the Xml class in this codebase

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

Change #1027792 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/InputBox@master] InputBox: switch from xml methods to html

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

Change #1027792 merged by jenkins-bot:

[mediawiki/extensions/InputBox@master] InputBox: switch from xml methods to html

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

Change #1028490 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/WikimediaIncubator@master] Stop using the Xml class in this codebase

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

Change #1028706 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/BibManager@master] Stop using the Xml class in this codebase

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

Change #1028496 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/UserGroups@master] Replace most of the more trivial Xml::… form builder methods

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

Change #1028755 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/MassEditRegex@master] Replace most of the more trivial Xml::… form builder methods

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

Change #1028490 merged by jenkins-bot:

[mediawiki/extensions/WikimediaIncubator@master] Stop using the Xml class in this codebase

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

Change #1028706 merged by jenkins-bot:

[mediawiki/extensions/BibManager@master] Stop using the Xml class in this codebase

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

Change #1028755 merged by jenkins-bot:

[mediawiki/extensions/MassEditRegex@master] Replace most of the more trivial Xml::… form builder methods

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

Change #1025304 merged by jenkins-bot:

[mediawiki/extensions/SubpageNavigation@master] Stop using the Xml class in this codebase

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

Change #1031297 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/PDFEmbed@master] Stop using the Xml class in this codebase

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

Change #1031297 merged by jenkins-bot:

[mediawiki/extensions/PDFEmbed@master] Stop using the Xml class in this codebase

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

Change #1025290 merged by jenkins-bot:

[mediawiki/extensions/CentralNotice@master] Replace more Xml::… methods with Html::… equivalents

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

Change #1028496 merged by jenkins-bot:

[mediawiki/extensions/UserGroups@master] Replace most of the more trivial Xml::… form builder methods

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

Change #1052668 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/CentralNotice@wmf_deploy] Merge branch 'master' into wmf_deploy

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

Change #1052668 merged by jenkins-bot:

[mediawiki/extensions/CentralNotice@wmf_deploy] Merge branch 'master' into wmf_deploy

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