W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2009

[whatwg] document.contentType

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 12 Jun 2009 22:35:58 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0906122235240.1648@hixie.dreamhostps.com>
On Wed, 3 Jun 2009, Brett Zamir wrote:
> 
> Regardless of any decision on whether my recommendation for 
> document.contentType to be standardized and made settable on a document 
> created by createDocument() (rather than needing to call the 
> less-than-intuitive doc.open() fix for HTML), I'd still like to 
> recommend standardizing on Mozilla's document.contentType ( 
> https://developer.mozilla.org/en/DOM/document.contentType ) for at least 
> being able to get the property.
> 
> It can be very useful for JavaScript code or a generic library to offer 
> support for XHTML or HTML, such as conditionally calling 
> getElementsByTagNameNS() (feature detection will not help since a 
> document may still be in HTML even if the browser supports XHTML).

On Wed, 3 Jun 2009, Simon Pieters wrote:
>
> 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.

On Wed, 3 Jun 2009, Jo?o Eiras wrote:
> 
> 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.

On Wed, 3 Jun 2009, Boris Zbarsky wrote:
>
> That's not what document.contentType returns in Gecko, though... 
> (especially if the server-sent value was empty, or didn't parse as a 
> valid content-type header).  What's the use case for knowing what the 
> server sent, as opposed to what the UA is treating the page as?

I don't really understand the use case here, so I haven't added anything 
yet. Could you clarify on what it is you are trying to solve?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 12 June 2009 15:35:58 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:13 UTC