[whatwg] document.contentType

João Eiras joao.eiras at gmail.com
Wed Jun 3 14:39:09 PDT 2009

> In HTML5, HTML elements in text/html are put in the XHTML namespace and text/html might contain SVG or MathML elements, so you probably want to conditionally call getElementsByTagNameNS based on e.g. the root element's namespaceURI rather than the document's HTMLness.

I think the major advantage of document.contentType is to know the value of the Content-Type header (without charset) sent by the server.
This would be good for 3rd party libraries or client side scripts.

More information about the whatwg mailing list