Skip to content

Conversation

@stephanieyzhang
Copy link

@stephanieyzhang stephanieyzhang commented Oct 2, 2025

OpaqueRange is a specialized, live AbstractRange subtype whose endpoints are offsets into a host-defined opaque string (e.g. the value space of <input>/<textarea> today, with a path to custom elements in the future). It enables range-based operations over encapsulated value text while avoiding exposure of internal DOM nodes.

(See WHATWG Working Mode: Changes for more details.)


/form-control-infrastructure.html ( diff )
/form-elements.html ( diff )
/index.html ( diff )
/input.html ( diff )

@stephanieyzhang stephanieyzhang changed the title Add FormControlRange hooks [DO NOT REVIEW] FormControlRange hooks Oct 2, 2025
@stephanieyzhang stephanieyzhang changed the title [DO NOT REVIEW] FormControlRange hooks Integrate FormControlRange hooks into text controls (input/textarea) Oct 9, 2025
@stephanieyzhang stephanieyzhang changed the title Integrate FormControlRange hooks into text controls (input/textarea) Integrate PlainTextRange hooks into text controls (input/textarea) Dec 4, 2025
@stephanieyzhang stephanieyzhang changed the title Integrate PlainTextRange hooks into text controls (input/textarea) Integrate OpaqueRange hooks into text controls (input/textarea) Jan 14, 2026
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is "supports opaque ranges" defined?

<th> <code data-x="dom-textarea/input-getValueRange">getValueRange()</code>
<td class="no"> &middot; <!-- Hidden -->
<td class="yes"> Yes <!-- Text -->
<td class="yes"> Yes <!-- Search -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong. Text and Search are the same column.

<li><p>Let <var>delta</var> be <var>replacementLength</var> minus (<var>replaceEnd</var> − <var>replaceStart</var>).</p></li>

<li>
<p>For each <code data-x="dom-Range-OpaqueRange">OpaqueRange</code> object <var>range</var> associated with <var>element</var>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If elements have to hold onto a range object we should make that explicit.

<ol>
<li>
<p>For each boundary offset of <var>range</var> (its <code data-x="dom-AbstractRange-startOffset">startOffset</code> and its
<code data-x="dom-AbstractRange-endOffset">endOffset</code>), run these substeps:</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this also needs some rewording. Perhaps you can define a set of steps and then run them for both. But we also don't want to reference public API in the user agent processing model.

<code data-x="dom-AbstractRange-endOffset">endOffset</code>), run these substeps:</p>

<ol>
<li><p>If the boundary offset is less than or equal to <var>replaceStart</var>, then continue.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continue needs to be referenced.

<p>The <code data-x="dom-textarea-defaultValue">defaultValue</code> attribute's setter must
<span>string replace all</span> with the given value within this element.</p>
<span>string replace all</span> with the given value within this element.
If this changes the element's <span data-x="concept-textarea-raw-value">raw value</span>, and the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally don't accept COMEFROM. And string replace all always changes the underlying node so "if this changes" is kinda moot anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants