Page MenuHomePhabricator

MediaWiki 1.16.5 does not produce valid XHTML
Closed, InvalidPublic

Description

Author: hods9000-289

Description:
MediaWiki 1.15.3 was XHTML 1.0 Transitional and had no errors.

MediaWiki 1.16.5 now uses XHTML 1.0 Strict. Why? It doesn't validate. It has 11 errors.


Version: 1.16.x
Severity: normal
Platform: PC

Details

Reference
bz29349

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 11:31 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz29349.
bzimport added a subscriber: Unknown Object (MLST).

Because it's in html5 mode (And html5 apparently allows you to have XHTML doc type, well still being an html5 document - see r59741. Basically this tricks an XML parser into thinking its valid XML, well still being valid HTML5 at the same time). If you validate it is html5 it should have less errors and still be conforming (I think anyways).

In any case if you really don't like it, you can put one of the following two things in LocalSettings.php :

$wgWellFormedXml = false;

This would make it output <!doctype html> instead of xhtml strict, which the validator might choke on less (however, both should be technically equally valid i think). However, this could break bots that want to think the document is xml, due to undefined entities. Probably not an issue unless you use things like pyWikipediaBot (I think) which parse pages as XML

Alternatively you can do:

$wgHtml5 = false;

Which will turn off html5 mode (and thus it will stop using some html5 features), and restore the previous doctype (transitional by default, but configurable in LocalSettings.php)

In 1.17, we stop outputting html entities, which makes the xml well-formedness thingy less of an issue, so we just output <!doctype html> all the time, which makes this a non-issue. ($wgWellFormedXml still controls if we use some html5 features that are invalid in xml, but starting 1.17 the html5 doctype is always used when in html5 mode regardless of what $wgWellFormedXml is)

Thus I can't imagine we're going to change anything as the issue goes away on 1.17, so I'm going to close this invalid. (but feel free to re-open if you don't think i should close it)

hods9000-289 wrote:

(In reply to comment #1)

Because it's in html5 mode (And html5 apparently allows you to have XHTML doc
type, well still being an html5 document - see r59741. Basically this tricks an
XML parser into thinking its valid XML, well still being valid HTML5 at the
same time). If you validate it is html5 it should have less errors and still be
conforming (I think anyways).

In any case if you really don't like it, you can put one of the following two
things in LocalSettings.php :

$wgWellFormedXml = false;

This would make it output <!doctype html> instead of xhtml strict, which the
validator might choke on less (however, both should be technically equally
valid i think). However, this could break bots that want to think the document
is xml, due to undefined entities. Probably not an issue unless you use things
like pyWikipediaBot (I think) which parse pages as XML

Alternatively you can do:

$wgHtml5 = false;

Which will turn off html5 mode (and thus it will stop using some html5
features), and restore the previous doctype (transitional by default, but
configurable in LocalSettings.php)

In 1.17, we stop outputting html entities, which makes the xml well-formedness
thingy less of an issue, so we just output <!doctype html> all the time, which
makes this a non-issue. ($wgWellFormedXml still controls if we use some html5
features that are invalid in xml, but starting 1.17 the html5 doctype is always
used when in html5 mode regardless of what $wgWellFormedXml is)

Thus I can't imagine we're going to change anything as the issue goes away on
1.17, so I'm going to close this invalid. (but feel free to re-open if you
don't think i should close it)

Hi, I tried using both pieces of code you gave me but neither worked.

I'm going to just INVALID this. It's months old. We output HTML5 with <!DOCTYPE html>. And 1.16 is obsolete.