Open Bug 1990256 Opened 9 months ago Updated 1 month ago

Implement OpaqueRange

Categories

(Core :: DOM: Forms, enhancement)

enhancement

Tracking

()

ASSIGNED

People

(Reporter: stephanie.zhang, Assigned: jjaschke)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed)

Attachments

(4 files, 1 obsolete file)

Steps to reproduce:

Filing this as a tracking bug for implementing FormControlRange.

Implement FormControlRange -- a specialized, live AbstractRange subclass for <input>/<textarea> value space. It enables range-based operations in native controls while restricting standard Range mutations to preserve encapsulation. It integrates cleanly with existing selection/editing behavior and closes a long-standing gap.

Explainer: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/FormControlRange/explainer.md

Ongoing WHATWG discussion thread: https://github.com/whatwg/html/issues/11478

Mozilla Standards Link: https://github.com/mozilla/standards-positions/issues/1289

Summary: Implement FormControlRange → Implement OpaqueRange

Updating this bug to reflect the current proposal.

The proposal has evolved from FormControlRange into OpaqueRange. OpaqueRange is a specialized, live AbstractRange subtype whose boundary points reference internal nodes within host-defined elements (for example, <input>/<textarea> today, with a path to custom elements in the future). It enables range-based operations over encapsulated content while avoiding exposure of internal DOM nodes.

The proposal also updates AbstractRange so startContainer/endContainer can be null, allowing OpaqueRange to return null for those getters while Range and StaticRange continue to return nodes.

Updated explainer:
https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/OpaqueRange/explainer.md

Current specification work:
https://github.com/whatwg/dom/pull/1404
https://github.com/whatwg/html/pull/11741

Relevant WHATWG discussion:
https://github.com/whatwg/html/issues/11478

Mozilla standards position issue:
https://github.com/WebKit/standards-positions/issues/541

Accidentally linked the Webkit standards position issue instead of Mozilla's -- should be https://github.com/mozilla/standards-positions/issues/1289

Refactor mIsDynamicRange to RangeType enum. Make startContainer/endContainer
nullable via BinaryName split. Add dom.opaque_range.enabled pref.

Assignee: nobody → jjaschke
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Implements OpaqueRange (dom.spec.whatwg.org/#interface-opaquerange) and its
HTML integration. OpaqueRange has two states: "live" (mStart/mEnd on the
anonymous text node) and "offset-only" (display:none / editor not init'd).

Offset tracking reconstructs user edits from beforeinput selection snapshots,
handles programmatic .value= as full replacement, and setRangeText with precise
offsets. Multi-range selections (Ctrl+click) are supported.

OpaqueRange lives in the text control's UA shadow DOM with its own
nsFrameSelection. Mirror OpaqueRanges into that internal frame selection
for highlight painting, and redirect Add/RemoveHighlightSelectionRange
to the correct frame selection.

Attachment #9583307 - Attachment is obsolete: true
Blocks: 2038248
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: