> On 20 Dec 2016, at 20:52, Mats Palmgren <[email protected]> wrote:
>
> The current spec editor seems open to discussing multi-range Selection,
> which is encouraging.
>
> Perhaps we could add something like this:
>
> selection.forEachRange(function (range) {
> // do awesome stuff
> })
>
> Since web developers are essentially doing this today:
> doAwesomeStuff(selection.getRangeAt(0));
>
> it seems it should be an easy upgrade to do this instead:
> selection.forEachRange(doAwesomeStuff);
I’d also be looking forward to see the ‘broken' selection spec move forward!
Perhaps even more intuitive (and shorter) to use would be a DOMList
selection.ranges that will be iterable (and mutable?), I think.
The selection world would unfold to:
```js
for (let range of selection.ranges) { … }
let range = selection.ranges.item(0); // or selection.ranges[0]
```
Mike.
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform