← Back to release summary

Range API improvements for rendered text content

Category
DOM
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
Start incubating

Summary

Expose a flat text representation of the rendered text of Range objects and allow developers to move a Range's DOM position endpoints over that representation.

Motivation

Ranges are somewhat limited in capabilities for advanced editing scenarios. While Ranges expose information about the rendering of the contained text via client rect(s), they only expose the text content (not the visible text — see differences) of the Range to script via toString(). Without this information, web developers resort to heuristics in JavaScript to map offsets of the visible text back to Node offsets in the DOM, which can be computationally expensive and error prone.

Standards & signals

Ecosystem

Explainers: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/RangeInnerText/explainer.md

View on chromestatus.com