[whatwg] HTML Editing Commands spec minor clarifications

Aryeh Gregor Simetrical+w3c at gmail.com
Fri May 13 11:52:51 PDT 2011

On Fri, May 13, 2011 at 2:13 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
> Note that the table comments above are telling.  If you want to allow
> selection of a table column, you have to allow multirange selection. There's
> just no way about it.

Yes, I know.  But the specific way Gecko handles multi-Range
Selections often doesn't make sense.  For instance, run this in Live
DOM Viewer:

<!doctype html>
var selection = getSelection();
var range = document.createRange();
range.setStart(document.head, 0);
range = document.createRange();
range = document.createRange();
range.setStart(document.head.firstChild, 0);

The log is:

log: HEAD
log: #document
log: HEAD

Notice how the focusNode is always that of the last Range added,
except that when you remove a Range it suddenly becomes the last Range
in document order (i.e., the last one in the order Gecko stores them).
 So adding and then removing a Range without doing anything else
changes the focus/anchor.  The weird behavior of multi-Range
Selections with execCommand() is also a case in point.

So if I get around to speccing all this, I'm going to spec something
in these cases that makes more sense than what Gecko does, since it's
not like there are likely to be big compat requirements in web
content.  (But I'm not sure I'll wind up speccing it, since I don't
know if any other engines actually want to implement multi-Range

More information about the whatwg mailing list