W3C home > Mailing lists > Public > public-html@w3.org > August 2007

Re: Implementing HTMLDocument on all Documents (detailed review of the DOM)

From: Maciej Stachowiak <mjs@apple.com>
Date: Tue, 21 Aug 2007 14:12:17 -0700
Cc: public-html <public-html@w3.org>
Message-Id: <D0FC8B18-082C-41F7-9C68-A98FAE7ED0E4@apple.com>
To: Simon Pieters <simonp@opera.com>

On Aug 21, 2007, at 3:27 AM, Simon Pieters wrote:

> (This is part of my detailed review of the Document Object Model  
> section.)
> The spec says about Documents:
>   All Document objects (in user agents implementing this  
> specification)
>   must also implement the HTMLDocument interface, available using
>   binding-specific methods. (This is the case whether or not the  
> document
>   in question is an HTML document or indeed whether it contains any  
>   elements at all.) Document objects must also implement the
>   document-level interface of any other namespaces found in the  
> document
>   that the UA supports. For example, if an HTML implementation also
>   supports SVG, then the Document object must implement HTMLDocument  
> and
>   SVGDocument.
> We're not happy with implementing the HTMLDocument interface on all  
> Document objects. It will affect all other types of documents and  
> the naming of their members in the future, and any additions to  
> HTMLDocument in the future becomes risky because it might break non- 
> HTML documents.


> However, if we don't implement all supported interfaces on all  
> Documents, the question instead becomes when do you implement a  
> specific interface? Firefox decides on the MIME type, Opera decides  
> on the root element's namespace, however I haven't yet checked how  
> this works when e.g. replacing the root element or when creating new  
> documents with DOM methods. This would need to be defined.

For an XHTML+SVG compound document by inclusion, you really want both  
the SVGDocument and HTMLDocument interfaces to be available,  
regardless of the MIME type or root element namespace. Otherwise you  
can't reuse scripts between an XHTML document that embeds SVG and an  
SVG document that embeds HTML. Even more significantly, some  
HTMLDocument/SVGDocument interfaces include important APIs that do  
things which can't be achieved any other way.

For instance, under your proposal document.execCommand and  
document.selection would be unavailable when SVG is the root, making  
it impossible to do HTML editing in XHTML embedded in SVG.

How would your proposal address this?

It also seems to me that the conflicts are few at present, and could  
be avoided in the relevant working groups in the future, in a way that  
is lower cost than pushing everything into Document. I do agree that  
adding some interfaces to Element could be helpful, but having GUI- 
oriented operations like focus() and click() may be seen as  
inappropriate in DOM Core.

Received on Tuesday, 21 August 2007 21:12:29 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:25 UTC