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

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

From: Ms2ger <ms2ger@gmail.com>
Date: Tue, 09 Aug 2011 18:20:54 +0200
Message-ID: <4E415E66.6010902@gmail.com>
To: David Flanagan <dflanagan@mozilla.com>
CC: www-dom@w3.org
Hi David,

On 08/09/2011 05:56 PM, David Flanagan wrote:
> I can't see anything in the DOMCore spec that references the fact that
> HTML defines lots of Element subclasses and that createElement('table'),
> for example, is supposed to return an instance of HTMLTableElement.
> Also, it is unclear to me what should happen if d is a document returned
> by createDocument (not createHTMLDocument) and I call
> d.createElement("table"). The spec is clear that the element will use
> the HTML namespace, but it is not clear whether the resulting object is
> instanceof HTMLTableElement or just Element.
> createElementNS() is similarly underspecified: under what circumstances
> does it create instances of the HTML-specific interfaces defined in the
> HTML spec?

Indeed, this is left up to the HTML specification. It defines [1] that 
elements must implement the interface listed in the definition box, 
which is HTMLTableElement for table elements [2].


[1] http://www.whatwg.org/html/#element-definitions
[2] http://www.whatwg.org/html/#the-table-element
Received on Tuesday, 9 August 2011 16:21:24 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:17 UTC