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.

Reply via email to