[whatwg/dom] Proposal: RangeList (#543)

In order to be able to manipulate spare ranges all at once, a `RangeList` class is a collection of `Range` instances exposing a limited amount of methods that would reflect into every rang of the list.

Mostly aimed to perform DOM manipulations all at once, hence extremely useful with methods such `cloneContents`, `deleteContents`, or `extractContents`, a list of ranges could be good to compare grouped boundaries too.

Thoughts ?

- - -

Answering @annevk from the previous thread:

> it seems this would be a set, not a list

set works too, I've used `List` based on current `Node` and `NodeList` convention.

> It'd be interesting to know how libraries approach these issues.

at least [this library](https://github.com/WebReflection/domdiff#domdiff) uses ranges to drop consecutive list of nodes that are no longer necessary and ideally it will move consecutive list of nodes while diffing instead of `insertingBefore` one node per time.

If libraries could address all changes at once grouping operations it'd be great overall for Web performance. Right now there is no way to tell the DOM to stop repainting/reflowing/dispatching per each node manipulated as part of a bigger operation so this proposal, based on what's possible already, would solve partially that issue.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/543

Received on Thursday, 7 December 2017 11:44:30 UTC