views:

700

answers:

3

In this answer to this question, Lachlan-Hunt writes the following:

With HTML5, you can choose to use HTML-only syntax, meaning that it is only compatible with being served and processed as text/html it is not well-formed XML. Or use XHTML-only syntax, meaning that is is well-formed XML, but uses XML features that are not compatible with HTML. Or, you can write a Polyglot document, which is conforming and compatible with both HTML and XHTML processing (In principle, this is conceptually similar to writing XHTML 1.0 that conforms with Appendix C guidelines).

What is a Polyglot document?

+13  A: 

A polyglot program is a program that is valid in more than one language. See http://en.wikipedia.org/wiki/Polyglot_(computing).

A polyglot (person) is someone who is fluent in many languages.

So the polyglot document in this case is both valid HTML and XHTML.

Apparently the word derives from the Ancient Greek πολύγλωττος (poluglōttos, “'many-tongued, polyglot'”), from πολύς (polus, “many”) + γλῶττα (glōtta, “'tongue, language'”)

Patrick McDonald
Master of jargon award +1
Brian
Thanks wikipedia, my saviour!
Patrick McDonald
Hm, searched for polyglot document both on google and wikipedia *sigh* Oh well :p Thanks!
Svish
Yeah, searching for "polyglot document" wasn't helpful for me either, so I then just searched for polyglot
Patrick McDonald
Funny, polyglot is part of my normal vocabulary. I wouldn't need to look it up. But then, I come from a polyglot (party Greek) family.
TRiG
+1  A: 

Poly glot comes from the greek meaning many tongues. Tongue in this case means language. So a polyglot person is a person who speakes many languages.

A polyglot document in this case is a document which "speaks" XHTML and HTML. So to an XHTML parser it looks perfectly formed, and it also looks perfectly formed to an HTML parser.

Nick Fortescue
+1  A: 

See the explanation in the HTML 5 Reference http://dev.w3.org/html5/html-author/#polyglot-documents

Lachlan Hunt