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

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       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 9 August 2011 20:01:51 UTC