[WA1] GUI Selections (was Re: [whatwg] Web Forms 2.0)

Olav Junker Kjær olav at olav.dk
Thu Feb 24 07:36:43 PST 2005


Matthew Raymond wrote:
> | var myRange = document.getSelection();
> 
>    The above gets the current selection within the document. If the 
> document doesn't have a selection, it returns document.createRange(). 
> Similarly, there will be a setSelection method:

You assume that the selection is a property of the document. This is 
like IE, while in Mozilla its a propery of the window (if I understand 
the API correctly).

I think it makes most sense to have the selection be a property of the 
viewport i.e. the window object. If we consider two frames containing 
two different views of the same document (this is theoretically possible 
according to the dom spec), it would seem natural to allow different 
focus and selections in each view. (If e.g. an HTML editor allowed two 
different wiews on the same page while editing, this would matter.)

Btw. the DocumentFocus interface in WA1 (section 11.3) also seem to 
assume that focus is a propery of the document rather than the viewport. 
Again I think its more correct to have it a property of the viewport.

regards
Olav Junker Kjær



More information about the whatwg mailing list