- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 28 Jan 2011 11:19:08 -0500
On 1/28/11 10:59 AM, Aryeh Gregor wrote: > 1) Are there real-world use-cases for multiple Ranges per Selection, > or was it just an attempt to be as general as possible? In Gecko you can select table cells in a table. For example, load this document: data:text/html,<table><tr><td>1<td>2<tr><td>3<td>4 then accel-click (Cmd-click on mac, Ctrl-click on Windows/Linux) the 1, then the 4. That this point the selection cannot be represented as a single range. You can also create multi-range selections in Gecko outside of tables. For example, load this document: data:text/html,1234567890 Click to the left of the 1 and drag right to between the 2 and the 3. Then release the mouse, accel-click between the 6 and the 7 and drag to between the 8 and the 9. Again, you have a 2-range selection. So to represent selections that users can make, you have to allow multiple ranges in a Selection object. > 4) Assuming that the answers to the last two questions are "no", would > Gecko be willing to drop support for multiple Ranges per Selection? The only ways we could do that would be to break user-facing selection behavior in our browser (which is obviously undesirable) or to make the DOM Selection object not actually reflect the state of the selection (again, seems undesirable). We might be willing to do the latter if it were really necessary, but that would significantly reduce the usefulness of the Selection API to developers, I think. On the other hand, multi-range selections can be very useful for scripting (e.g. Gecko actually uses them to implement spellcheck underlining, search result highlighting, and so forth). So it seems to me that a better direction is to allow multi-range selection in UAs in general. -Boris
Received on Friday, 28 January 2011 08:19:08 UTC