Re: [whatwg/dom] Add FormControlRange interface (PR #1404)

@dandclark commented on this pull request.



> +     "{{NotSupportedError!!exception}}" {{DOMException}}.</li>
+ <li>Let <var>len</var> be the length of <var>element</var>’s <i>value string</i>.</li>
+ <li>If <var>start</var> &gt; <var>len</var> or <var>end</var> &gt; <var>len</var>, then
+     <a>throw</a> an "{{IndexSizeError!!exception}}" {{DOMException}}.</li>
+ <li>If <var>start</var> &gt; <var>end</var>, then set <var>end</var> to <var>start</var>.</li>
+ <li>Set <a for=FormControlRange>control</a> to <var>element</var>,
+     <a for=FormControlRange>start offset</a> to <var>start</var>, and
+     <a for=FormControlRange>end offset</a> to <var>end</var>.</li>
+</ol>
+
+<p>A {{FormControlRange}} is <em>live</em>: when the control’s value string changes, the range’s
+{{AbstractRange/startOffset}} and {{AbstractRange/endOffset}} are updated automatically
+to preserve the same logical content. These behaviors mirror {{Range}} boundary adjustments
+in the DOM, but are applied to the UTF-16 code units of a form control’s value.</p>
+
+<ul>

See how for `Range`, the liveness is implemented by handling range updates anywhere the node tree is changed, e.g. in https://dom.spec.whatwg.org/#concept-node-insert.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1404#discussion_r2383058923
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1404/review/3273234058@github.com>

Received on Friday, 26 September 2025 17:43:42 UTC