W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2011

Re: [DOMCore] createElement() and HTML-specific element interfaces

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 9 Aug 2011 20:01:26 +0000 (UTC)
To: David Flanagan <dflanagan@mozilla.com>
cc: Ms2ger <ms2ger@gmail.com>, www-dom@w3.org
Message-ID: <Pine.LNX.4.64.1108091958190.22648@ps20323.dreamhostps.com>
On Tue, 9 Aug 2011, David Flanagan wrote:
> 
> But more to the point, the DOM spec also needs to say when those 
> additional HTML requirements apply.  If I create a "table" element in 
> each of these scenarios, in which of them to do I get an 
> HTMLTableElement?
> 
> 1) html document, createElement
> 2) non-html document, createElement
> 3) html document, createElementNS, HTML namespace
> 4) html document, createElementNS, non-HTML namespace
> 5) non-html document, createElementNS, HTML namespace
> 6) non-html document, createElementNS, non-HTML namespace

The HTML spec, if it applies to your user agent, says it must happen for 
1, 2, 3, and 5.


> There is a similar situation for DOMImplementation.createDocument() and 
> DOMImplementation.createHTMLDocument().  The DOM spec should note that 
> the HTML spec imposes additional requirements on the object reaturned by 
> createHTMLDocument().  (i.e. that it must implement the HTMLDocument 
> interface).

If the HTML spec applies to your UA, all Document objects must implement 
HTMLDocument, regardless of how they are constructed.


> Note that since DOM already defines a flag that creates a distinction 
> between HTML documents and XML documents.  It will be very confusing if 
> createDocument() returns an "XML document" that implements the methods 
> of HTMLDocument!

Why would that be confusing? HTMLDocument's APIs apply in XHTML and HTML 
equally. In fact the API is (mostly) serialisation-agnostic. There might 
not even be a serialisation.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 9 August 2011 20:01:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:08 GMT