Polyglot markup is a polyglot HTML document that has been written to conform to both the HTML and XHTML specifications. A document in polyglot markup can therefore be parsed as either valid HTML or XML, and will produce the same DOM structure either way.
Polyglot markup is HTML that has been written to conform to both the HTML and XHTML specifications.
A document that uses polyglot markup is a document that is a stream of bytes that parses into identical document trees (with the exception of the xmlns attribute on the root element) when processed as HTML and when processed as XML.
Polyglot markup that meets a well defined set of constraints is interpreted as compatible, regardless of whether they are processed as HTML or as XHTML, per the HTML5 specification.
To meet these criteria, polyglot markup is written in well-formed XHTML and uses a specific DOCTYPE, namespace declarations, and a specific case—normally lower case but occasionally camel case—for element and attribute names.
Polyglot markup uses lower case for certain attribute values. Further constraints include those on empty elements, named entity references, and the use of scripts and style.
The same document can then be served as either HTML or XHTML, depending on browser support and MIME type.