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

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

From: Simon Pieters <simonp@opera.com>
Date: Tue, 21 Aug 2007 12:27:31 +0200
To: public-html <public-html@w3.org>
Message-ID: <op.txenb5z1idj3kv@hp-a0a83fcd39d2>

(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 HTML
    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

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.

We'd rather have the members of HTMLDocument that are useful for all types  
of documents to be moved to the Document interface. This would probably be:

   * location
   * URL (also present in SVGDocument)
   * domain (also present in SVGDocument)
   * referrer (also present in SVGDocument)
   * cookie
   * lastModified
   * getElementsByClassName
   * innerHTML
   * activeElement
   * hasFocus
   * getSelection

Furthermore, it might make sense to move the following members from  
HTMLElement to the Element interface:

   * getElementsByClassName
   * innerHTML
   * click()
   * focus()
   * blur()
   * scrollIntoView()

...because those might well be useful for any type of element.

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.

I realise that moving members to Document and Element means changing DOM  
Core, so coordination with the WebAPI WG would be necessary.

Simon Pieters
Opera Software
Received on Tuesday, 21 August 2007 10:27:42 UTC

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