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
- Firefox: No signal
- Safari: No signal
- Web developers: No signals — No direct signals on this specific proposals to date, but here are some links to discussion on the web on this class of issues: http://perfectionkills.com/the-poor-misunderstood-innerText/#case-for-innerText https://github.com/timdown/rangy/wiki/Text-Range-Module
- Tracking bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1309193
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=range-api-improvements-for-rendered-text-content
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Range%20API%20improvements%20for%20rendered%20text%20content
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Range%20API%20improvements%20for%20rendered%20text%20content
- Baseline status: https://webstatus.dev/?q=Range%20API%20improvements%20for%20rendered%20text%20content
Explainers: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/RangeInnerText/explainer.md