Questions
In terms of browser support and HTML5 compliance, (assuming page is actually XML well-formed) how convenient is to serve HTML5 polyglot page with application/xhtml+xml HTTP Content-type header?
In earlier times I served XHTML width text/html header instead, because otherwise some browsers not rendered page at all or rendered but have some oddities in behavior.
Does HTML5 standard even requires browsers to support application/xhtml+xml content-type? What is the actual state of support across browsers? What are todays drawbacks of serving with application/xhtml+xml?
Answers
No, HTML5 does not require browsers to support either application/xhtml+xml or text/html.
http://www.w3.org/TR/html5/infrastructure.html#conformance-classes
http://www.w3.org/TR/html5/infrastructure.html#conformance-classes
For compatibility with existing content and prior specifications, this
specification describes two authoring formats: one based on XML
(referred to as the XHTML syntax), and one using a custom format
inspired by SGML (referred to as the HTML syntax). Implementations
must support at least one of these two formats, although supporting
both is encouraged.
Since IE9, application/xhtml+xml has been supported on all browsers of note.
Assuming you can author well-formed XML, which really isn t all that hard, the biggest gotcha is that not all Unicode characters are valid XML characters, so you must always have additional sanitization of user input that might be echoed to the screen to clean up any characters that are not valid in XML, or your web page will fail to render correctly (or at all).
Also, third party JS libraries are not always polyglot compatible. In particular, some rely on document.write() which isn t supported for XML documents.
Source
License : cc by-sa 3.0
http://stackoverflow.com/questions/26588347/acceptance-of-html5-polyglot-served-as-application-xhtmlxml
Related