[whatwg] Request for implementer feedback: multiple Ranges per Selection

Test case:

<!doctype html>
<p id=test>Abcdefghi
<script>
var selection = getSelection();
var p = document.getElementById("test").firstChild;
var range = document.createRange();
range.setStart(p, 0);
range.setEnd(p, 1);
selection.removeAllRanges();
selection.addRange(range);
var range = document.createRange();
range.setStart(p, 3);
range.setEnd(p, 4);
selection.addRange(range);
alert(selection.rangeCount);
</script>

Firefox 4.0b9 alerts "2".  Chrome dev, Opera 11, and IE9 beta all
alert "1".  I haven't checked their exact behavior, but whatever it
is, they seem to only allow one Range per Selection.  So my questions
are:

1) Are there real-world use-cases for multiple Ranges per Selection,
or was it just an attempt to be as general as possible?

2) Have WebKit or Opera run into any websites that depend on being
able to use multiple Ranges per Selection?

3) Are WebKit or Opera planning to add support for multiple Ranges per
Selection?  (I'd be interested in IE too, clearly, but they don't read
this list.)

4) Assuming that the answers to the last two questions are "no", would
Gecko be willing to drop support for multiple Ranges per Selection?

Received on Friday, 28 January 2011 07:59:54 UTC