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

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

From: Charles McCathieNevile <chaals@opera.com>
Date: Tue, 21 Aug 2007 13:54:09 +0200
To: "Web API public" <public-webapi@w3.org>
Message-ID: <op.txercjsowxe0ny@widsith.local>

This is from the HTML group, but my first impression is that Simon is  
right. Unfortunately my other first impression is that nobody is currently  
really working on the relevant specs - is that true?

cheers

Chaals

------- Forwarded message -------
From: "Simon Pieters" <simonp@opera.com>
To: public-html <public-html@w3.org>
Cc:
Subject: Implementing HTMLDocument on all Documents (detailed review of  
the DOM)
Date: Tue, 21 Aug 2007 12:27:31 +0200

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

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.



-- 
   Charles McCathieNevile, Opera Software: Standards Group
   hablo español  -  je parle français  -  jeg lærer norsk
chaals@opera.com    Catch up: Speed Dial   http://opera.com
Received on Tuesday, 21 August 2007 11:54:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:58 GMT