Re: DOM Views confusion

On Wed, 22 Mar 2006, Cameron McCormack wrote:
> 
> Ian Hickson:
> > Currently in the DOM there are two ways of getting at views: the 
> > document.defaultView attribute, and the view attribute of UIEvent objects.
> 
> So if the ViewCSS is not the default view, there is actually no way to 
> get to it?

In typical desktop browsers, the defaultView attribute should point to an 
object which is all of the following:

   The ECMAScript global object
   An object implementing Window
   An object implementing AbstractView
   An object implementing ViewCSS


> > I don't know of any UA that actually implements multiple Views.
> 
> I'm trying to fit Window into Batik.  Currently, it has a ViewCSS as its
> default view.

See the WHATWG spec (and the WebAPI Window spec, probably). ViewCSS is one 
of the interfaces implemented by Window.


> It doesn't make sense (wrt Batik's class hierarchy) to have that object 
> also implement Window, so these two views will have to be separate 
> objects.

You'll have to provide "language-specific casting methods" to get from the 
Window object to the ViewCSS object. Conceptually, they're the same.


> Am I correct in surmising, then, that implementing Window and exposing 
> computed styles are mutually exclusive, unless both views are 
> implemented by the same (default) view, and code makes the assumption 
> that it is that default view that implements ViewCSS?

I'm not sure what you mean here.


> It looks to me like DocumentView needs to expose all views of the 
> document somehow.

In practice there is rarely more than one. Opera is the only browser I 
know that actually supports multiple views, and it only has one View (you 
can't get to the computed styles in its aural view; indeed I'm not sure 
it even implements the concept of multiple media correctly).

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 22 March 2006 06:00:14 UTC