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.

Motivation

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.

Specification

Specification link


Specification being incubated in a Community Group

Status in Chromium

Blink>DOM


Enabled by default (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • Shipped/Shipping
  • No signal
  • Shipped/Shipping
  • Strongly positive

Owners

Intent to Prototype url

Intent to Prototype thread

Search tags

StaticRange,

Last updated on 2021-09-06