Currently, Range is the only constructible range type available to web authors. However, Range objects are "live" and maintaining them can be expensive. For every tree change, all affected Range objects need to be updated. StaticRange objects are not live and represent a lightweight range type that is not subject to the same maintenance cost as Range. By making StaticRange constructible, we will allow web authors to use them for ranges that do not need to be updated on every DOM tree change.
We believe this feature will be used widely with the custom highlight API - I2P coming soon - which will allow web authors to style arbitrary ranges. This is useful in a variety of scenarios, including editing frameworks that wish to implement their own selection, find-on-page over virtualized documents, and spellchecking frameworks.
Status in Chromium
Enabled by default (tracking bug) in:
- Chrome for desktop release 90
- Chrome for Android release 90
- Android WebView release 90
Consensus & Standardization
- No signal
- Strongly positive
Intent to Prototype urlIntent to Prototype thread
Last updated on 2021-02-18