[wp-meta] [Making WordPress.org] #8159: Trac pages claim XHTML, render as HTML5

Making WordPress.org noreply at wordpress.org
Mon Jan 26 18:21:25 UTC 2026


#8159: Trac pages claim XHTML, render as HTML5
--------------------------+--------------------
 Reporter:  jonsurrell    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:
Component:  General       |   Keywords:
--------------------------+--------------------
 Trac pages start with XHTML `DOCTYPE` and `xmlns` attributes:

 {{{#!xml
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 }}}

 However, the pages are not XHTML pages. They are HTML5 (in no-quirks
 mode). This is likely due to the `Content-type: text/html` HTTP header.

 It would be nice to remove the misleading XHTML parts and start the
 document as normative HTML5:

 {{{#!xml
 <!DOCTYPE html>
 <html>
 }}}

 I have confirmed this behavior on

 - [https://core.trac.wordpress.org/changeset/61477 Changesets]
 - [https://core.trac.wordpress.org/ticket/64419 Tickets]
 - [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/html-api
 /class-wp-html-tag-processor.php Source browser]

 -----


 This can be verified in a few ways:

 Modify request headers to use `Content-type:
 application/xhtml+xml;charset=utf-8`. Chrome shows several errors on Trac
 changesets in this case.

 Without modifying headers, you can verify that the document is _not_
 XHTML. In an XHTML document, this will error:

 {{{#!javascript
 document.body.innerHTML += "<meta name='xml-must-self-close'>"
 }}}

 > Uncaught SyntaxError: Failed to set the 'innerHTML' property on
 'Element': The provided markup is invalid XML, and therefore cannot be
 inserted into an XML document.

 Finally, this snippet can indicate whether the document is in no-quirks,
 limited-quirks, or quirks mode. (`document.compatMode` will not
 distinguish between limited-quirks and no-quirks):

 {{{
 document.body.innerHTML = `
 <style>
 p > table { background-color: red; height: 10px; width: 10px }
 td { background-color: orange; }
 </style>

 <ul>
 <li>In quirks and limited-quirks, this table is composed of square cells.
 <li>In quirks mode, it will have a red background (because <code>P >
 TABLE</code> is allowed).
 <li>In no-quirks mode, the cells become tall rectangles.
 </ul>

 <p><table>
 <td><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'
 width='10' height='10'%3E%3Crect width='10' height='10'
 fill='blue'/%3E%3C/svg%3E">
 <td><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'
 width='10' height='10'%3E%3Crect width='10' height='10'
 fill='blue'/%3E%3C/svg%3E">
 <tr>
 <td><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'
 width='10' height='10'%3E%3Crect width='10' height='10'
 fill='blue'/%3E%3C/svg%3E">
 <td><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'
 width='10' height='10'%3E%3Crect width='10' height='10'
 fill='blue'/%3E%3C/svg%3E">
 </table>
 </p>
 `
 }}}

-- 
Ticket URL: <https://meta.trac.wordpress.org/ticket/8159>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list