Requests for comment/Drop XHTML 1.0

From MediaWiki.org
Jump to navigation Jump to search
Request for comment (RFC)Requests for comment
Drop XHTML 1.0
Component General
Creation date 2013-05-10
Author(s) Daniel Friesen
Document status implemented
General2013-05-10Daniel Friesen

XHTML 1.x is practically dead (and XHTML 2 never had a foot to stand on), HTML5 is used by default in MediaWiki and it's enabled on Wikimedia wikis. XHTML 1.0 support in MediaWiki is basically a mode where MediaWiki outputs tag soup by ancient rules that don't even follow what browsers do, disables enhancements like search placeholders, and helpful form input types, disables optional support for RDFa or Microdata, won't parse markup used by editors like <time> and <mark>, and disables data-* support which is used by a number of MediaWiki features (mw-collapse, data-sort-value, jquery.localize, etc...) effectively disabling support for or limiting use of those features.

For those obsessed with the XML notion of XHTML we may as well slightly improve XHTML5 support in MediaWiki when a user sets $wgMimeType to a mime type which HTML5 defines as triggering XHTML5. For the most part this will only be a change in the region where the DOCTYPE and opening <html> tag are output. As $wgWellFormedXml already takes care of making sure output is well formed enough for XHTML.

Changes[edit]

  • $wgHtml5 use throughout core can be removed as this variable will become irrelevant. Paths of code that only apply when false can be deleted.
  • $wgDocType and $wgDTD will become irrelevant and will be removed.
  • There is no reason to modify the XHTML5 xmlns and hence $wgXhtmlDefaultNamespace can be removed.
  • For posterity we might as well update Html::isXmlMimeType to follow HTML5's rules and consider all +xml subtypes as XHTML instead of only appliction/xhtml+xml.
  • For XHTML5 support we can tweak what we output when Html::isXmlMimeType( $wgMimeType ) is true:
    • Output an <?xml version="1.0" encoding="UTF-8" ?>.
    • XHTML5 doesn't need a DOCTYPE so we might as well leave it out.
    • Output a fixed xmlns="http://www.w3.org/1999/xhtml" on <html>.
    • Support $wgXhtmlNamespaces on <html>.

Links[edit]