From e19d60b30ec54e7f5b76a6e82211f184b9d8332d Mon Sep 17 00:00:00 2001 From: Stephanie Y Zhang Date: Fri, 12 Sep 2025 06:48:49 -0700 Subject: [PATCH 1/7] initial changes --- dom.bs | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 107 insertions(+), 4 deletions(-) diff --git a/dom.bs b/dom.bs index e61c3fc0..04460458 100644 --- a/dom.bs +++ b/dom.bs @@ -8381,7 +8381,7 @@ constructor steps are to set this's data to Ranges -

Introduction to "DOM Ranges"

+

Introduction to "DOM Ranges"

// Start here

{{StaticRange}} and {{Range}} objects (ranges) represent a sequence of content within a node tree. Each range has a start and an end which @@ -8494,7 +8494,7 @@ be between 0 and the boundary point's node's -

Interface {{AbstractRange}}

+

Interface {{AbstractRange}}

// Abstract Range
 [Exposed=Window]
@@ -8561,7 +8561,7 @@ getter steps are to return this's end offset.
 getter steps are to return true if this is collapsed; otherwise false.
 
 
-

Interface {{StaticRange}}

+

Interface {{StaticRange}}

// Static Range
 dictionary StaticRangeInit {
@@ -8614,7 +8614,7 @@ constructor steps are:
 
 
 
-

Interface {{Range}}

+

Interface {{Range}}

// Range
 [Exposed=Window]
@@ -9891,8 +9891,111 @@ and {{Range/getBoundingClientRect()}} methods are defined in other specification
 [[DOM-Parsing]]
 [[CSSOM-VIEW]]
 
+// End here
 
 
+

Interface {{FormControlRange}}

+ +
+[Exposed=Window]
+interface FormControlRange : AbstractRange {
+  constructor();
+
+  undefined setFormControlRange((HTMLInputElement or HTMLTextAreaElement) element,
+                                unsigned long startOffset,
+                                unsigned long endOffset);
+
+  stringifier;
+};
+
+ +
+
formRange = new FormControlRange() +
Creates a new live range that can refer to text within a supported text control. + +
formRange . setFormControlRange(element, startOffset, endOffset) +
Sets the range to refer to the substring of element.value starting at + startOffset and ending at endOffset. Throws if element is not a + supported text control or if offsets are out of bounds. +
+ +

Objects implementing the {{FormControlRange}} interface are live and update as their associated +element's user-visible value changes. They do not expose or mutate any +implementation-internal nodes of the element.

+ +

A {{FormControlRange}} has an associated element, +which is a supported text control (<textarea> or an <input> whose +type is one of text, search, tel, +url, or password).

+ +

For a {{FormControlRange}}, the start node and end node are +both the element, and the start offset and end offset are +interpreted as 16-bit code unit indices into the element's value. These offsets do +not refer to the element's children.

+ +

This differs from {{Range}}, where offsets for non-{{CharacterData}} nodes refer to child +indices. {{FormControlRange}} offsets always refer to positions within the control's value.

+ +

The new FormControlRange() +constructor steps are to construct a new {{FormControlRange}} whose element, start, +and end are initially unset.

+ +

The +setFormControlRange(element, startOffset, endOffset) +method steps are:

+ +
    +
  1. +

    If element is not a supported text control (i.e., neither a {{HTMLTextAreaElement}} nor an + {{HTMLInputElement}} whose type is one of + text, search, tel, url, or password), + then throw a "{{NotSupportedError!!exception}}" {{DOMException}}.

    + +
  2. Let L be the length, in 16-bit code units, of element's value.

    + +
  3. +

    If startOffset greater than L or endOffset greater than L, + then throw an "{{IndexSizeError!!exception}}" {{DOMException}}.

    + +
  4. +

    If startOffset less than 0 or endOffset less than 0, then throw an + "{{IndexSizeError!!exception}}" {{DOMException}}.

    + +
  5. +

    If startOffset is greater than endOffset, then set + startOffset and endOffset to startOffset. This matches + {{Range}}'s collapsing behavior for reversed endpoints.

    + +
  6. +

    Set this's element to element. Set this's start to + (element, startOffset) and end to + (element, endOffset).

    +
+ +

Because a {{FormControlRange}} extends {{AbstractRange}}, its +startContainer, startOffset, +endContainer, endOffset, and +collapsed attributes work as defined for {{AbstractRange}}, with the +interpretation described above.

+ +

The stringification behavior +must return the substring of this's element's value defined by this's +start offset and end offset.

+ +

Live update semantics

+ +

User agents must update {{FormControlRange}} objects as their element's value is +mutated so that they continue to refer to the same logical text positions. This updating must behave as +if the element's value were represented by a single {{Text}} node that is a child of +the element, and modifications to value performed the corresponding replace data +operations on that conceptual node. In particular, boundary points are adjusted per the existing +live range mutation rules that apply to {{CharacterData}} changes.

+ +

Layout and geometry methods such as getClientRects() and +getBoundingClientRect() are defined in other specifications as partial interfaces on {{Range}}. +Those specifications can extend {{FormControlRange}} in the same way; when present, they operate over the +text rendered by the element's value.

+

Traversal

{{NodeIterator}} and {{TreeWalker}} objects can be used to filter and traverse node From d7b3bee51118dd712074f16d787bd693ea0f4b3e Mon Sep 17 00:00:00 2001 From: Stephanie Zhang Date: Tue, 23 Sep 2025 14:55:45 -0500 Subject: [PATCH 2/7] update to match format of other ranges --- dom.bs | 175 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 96 insertions(+), 79 deletions(-) diff --git a/dom.bs b/dom.bs index 04460458..2cb79610 100644 --- a/dom.bs +++ b/dom.bs @@ -8381,7 +8381,7 @@ constructor steps are to set this's data to Ranges -

Introduction to "DOM Ranges"

// Start here +

Introduction to "DOM Ranges"

{{StaticRange}} and {{Range}} objects (ranges) represent a sequence of content within a node tree. Each range has a start and an end which @@ -8494,7 +8494,7 @@ be between 0 and the boundary point's node's -

Interface {{AbstractRange}}

// Abstract Range +

Interface {{AbstractRange}}

 [Exposed=Window]
@@ -8561,7 +8561,7 @@ getter steps are to return this's end offset.
 getter steps are to return true if this is collapsed; otherwise false.
 
 
-

Interface {{StaticRange}}

// Static Range +

Interface {{StaticRange}}

 dictionary StaticRangeInit {
@@ -8614,7 +8614,7 @@ constructor steps are:
 
 
 
-

Interface {{Range}}

// Range +

Interface {{Range}}

 [Exposed=Window]
@@ -9891,8 +9891,6 @@ and {{Range/getBoundingClientRect()}} methods are defined in other specification
 [[DOM-Parsing]]
 [[CSSOM-VIEW]]
 
-// End here
-
 
 

Interface {{FormControlRange}}

@@ -9905,96 +9903,115 @@ interface FormControlRange : AbstractRange { unsigned long startOffset, unsigned long endOffset); + DOMRectList getClientRects(); + DOMRect getBoundingClientRect(); stringifier; };
-
-
formRange = new FormControlRange() -
Creates a new live range that can refer to text within a supported text control. +

Objects implementing the {{FormControlRange}} interface are known as +live FormControlRanges.

-
formRange . setFormControlRange(element, startOffset, endOffset) -
Sets the range to refer to the substring of element.value starting at - startOffset and ending at endOffset. Throws if element is not a - supported text control or if offsets are out of bounds. +
+
formControlRange = new + FormControlRange() +
Returns a new live FormControlRange that tracks text offsets in a text control’s + value as it changes.
+ +
formControlRange . + {{FormControlRange/setFormControlRange()}} (element, + startOffset, endOffset) +
Sets the endpoints to [start, end) within element’s + value string. Throws {{NotSupportedError}} for unsupported elements and + {{IndexSizeError}} for out-of-bounds offsets.
-

Objects implementing the {{FormControlRange}} interface are live and update as their associated -element's user-visible value changes. They do not expose or mutate any -implementation-internal nodes of the element.

- -

A {{FormControlRange}} has an associated element, -which is a supported text control (<textarea> or an <input> whose -type is one of text, search, tel, -url, or password).

- -

For a {{FormControlRange}}, the start node and end node are -both the element, and the start offset and end offset are -interpreted as 16-bit code unit indices into the element's value. These offsets do -not refer to the element's children.

+

A {{FormControlRange}} is a range whose boundary points are defined in the +host text control’s value string rather than in the node tree. Its +start node and end node are always the host +<input> or <textarea>, and its offsets are indices into that +string.

-

This differs from {{Range}}, where offsets for non-{{CharacterData}} nodes refer to child -indices. {{FormControlRange}} offsets always refer to positions within the control's value.

- -

The new FormControlRange() -constructor steps are to construct a new {{FormControlRange}} whose element, start, -and end are initially unset.

+

A {{FormControlRange}} has associated state:

+
    +
  • control + (null or an {{HTMLInputElement}}/{{HTMLTextAreaElement}})
  • +
  • start offset + (a non-negative integer)
  • +
  • end offset + (a non-negative integer)
  • +
-

The -setFormControlRange(element, startOffset, endOffset) +

The {{AbstractRange/startContainer}} and {{AbstractRange/endContainer}} getters of a +{{FormControlRange}} return its control. The +{{AbstractRange/startOffset}} and {{AbstractRange/endOffset}} getters return its +start offset and end offset. +{{AbstractRange/collapsed}} is true if and only if the two offsets are equal.

+ +

An {{Element}} el supports form control ranges if it is an {{HTMLTextAreaElement}}, +or an {{HTMLInputElement}} whose type +supports the selection APIs: +"text", "search", "tel", "url", or +"password".

+ +

For a supported host element el, its value string is the same string exposed by +its IDL attribute {{HTMLTextAreaElement/value}}/{{HTMLInputElement/value}}. Offsets for +{{FormControlRange}} are indices into this string in the inclusive range +[0, value.length], matching +{{HTMLTextAreaElement/selectionStart}}/{{HTMLTextAreaElement/selectionEnd}} and +{{HTMLInputElement/selectionStart}}/{{HTMLInputElement/selectionEnd}} units.

+ +

The +new FormControlRange() constructor steps are to set this’s +control to null and its +start offset and end offset to 0.

+ +

The +setFormControlRange(element, start, end) method steps are:

    -
  1. -

    If element is not a supported text control (i.e., neither a {{HTMLTextAreaElement}} nor an - {{HTMLInputElement}} whose type is one of - text, search, tel, url, or password), - then throw a "{{NotSupportedError!!exception}}" {{DOMException}}.

    +
  2. If element does not support form control ranges, then throw a + "{{NotSupportedError!!exception}}" {{DOMException}}.
  3. +
  4. Let len be the length of element’s value string.
  5. +
  6. If start > len or end > len, then + throw an "{{IndexSizeError!!exception}}" {{DOMException}}.
  7. +
  8. If start > end, then set end to start.
  9. +
  10. Set control to element, + start offset to start, and + end offset to end.
  11. +
-
  • Let L be the length, in 16-bit code units, of element's value.

    +

    A {{FormControlRange}} is live: 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.

    -
  • -

    If startOffset greater than L or endOffset greater than L, - then throw an "{{IndexSizeError!!exception}}" {{DOMException}}.

    +
      +
    • Edits before the range: Offsets shift by the net length change.
    • +
    • Edits after the range: Offsets remain unchanged.
    • +
    • Edits overlapping the range: If a boundary falls inside text that was removed, + move it to the start of the change. If the edit also inserted new text, remap the boundary + into the inserted span at the closest corresponding offset, not exceeding its end.
    • +
    • Insertion at the start boundary: A non-{{AbstractRange/collapsed}} range expands + to include the new text. A collapsed range (caret) moves after the insertion.
    • +
    • Insertion at the end boundary: A non-collapsed range does not expand to include + the new text. A collapsed range moves after the insertion.
    • +
    • Clamping and collapse: Offsets are clamped to the current value length. If the + {{AbstractRange/startOffset}} would exceed the {{AbstractRange/endOffset}}, set the end to the + start.
    • +
    -
  • -

    If startOffset less than 0 or endOffset less than 0, then throw an - "{{IndexSizeError!!exception}}" {{DOMException}}.

    +

    The stringification behavior must run these steps:

    -
  • -

    If startOffset is greater than endOffset, then set - startOffset and endOffset to startOffset. This matches - {{Range}}'s collapsing behavior for reversed endpoints.

    +
      +
    1. If control is null, then return the empty string.

      +
    2. Let value be control's value string.

      +
    3. Let start be start offset, and let end be min(end offset, value.length).

      +
    4. If startend, then return the empty string.

      +
    5. Return the substring of value from start to end.

      +
    -
  • -

    Set this's element to element. Set this's start to - (element, startOffset) and end to - (element, endOffset).

    - - -

    Because a {{FormControlRange}} extends {{AbstractRange}}, its -startContainer, startOffset, -endContainer, endOffset, and -collapsed attributes work as defined for {{AbstractRange}}, with the -interpretation described above.

    - -

    The stringification behavior -must return the substring of this's element's value defined by this's -start offset and end offset.

    - -

    Live update semantics

    - -

    User agents must update {{FormControlRange}} objects as their element's value is -mutated so that they continue to refer to the same logical text positions. This updating must behave as -if the element's value were represented by a single {{Text}} node that is a child of -the element, and modifications to value performed the corresponding replace data -operations on that conceptual node. In particular, boundary points are adjusted per the existing -live range mutation rules that apply to {{CharacterData}} changes.

    - -

    Layout and geometry methods such as getClientRects() and -getBoundingClientRect() are defined in other specifications as partial interfaces on {{Range}}. -Those specifications can extend {{FormControlRange}} in the same way; when present, they operate over the -text rendered by the element's value.

    Traversal

    From 05b6b0ae575a0ea0f3fcdd5430ce41e983d8ed0e Mon Sep 17 00:00:00 2001 From: Stephanie Zhang Date: Mon, 29 Sep 2025 11:27:48 -0500 Subject: [PATCH 3/7] address dan's comments --- dom.bs | 119 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 71 insertions(+), 48 deletions(-) diff --git a/dom.bs b/dom.bs index 2cb79610..a0d2f1af 100644 --- a/dom.bs +++ b/dom.bs @@ -4,6 +4,7 @@ H1: DOM Shortname: dom Text Macro: TWITTER thedomstandard Text Macro: LATESTRD 2025-06 +Text Macro: COMMIT-SHA 0000000 Abstract: DOM defines a platform-neutral model for events, aborting activities, and node trees. Translation: ja https://triple-underscore.github.io/DOM4-ja.html Translation: zh-Hans https://htmlspecs.com/dom/ @@ -9902,6 +9903,8 @@ interface FormControlRange : AbstractRange { undefined setFormControlRange((HTMLInputElement or HTMLTextAreaElement) element, unsigned long startOffset, unsigned long endOffset); + DOMRectList getClientRects(); DOMRect getBoundingClientRect(); @@ -9910,26 +9913,26 @@ interface FormControlRange : AbstractRange {
  • Objects implementing the {{FormControlRange}} interface are known as -live FormControlRanges.

    +{{FormControlRange}} objects.

    formControlRange = new - FormControlRange() -
    Returns a new live FormControlRange that tracks text offsets in a text control’s - value as it changes.
    + FormControlRange() +
    Returns a new {{FormControlRange}} that tracks text offsets in a text + control's value as it changes.
    formControlRange . - {{FormControlRange/setFormControlRange()}} (element, + {{FormControlRange/setFormControlRange()}}(element, startOffset, endOffset) -
    Sets the endpoints to [start, end) within element’s - value string. Throws {{NotSupportedError}} for unsupported elements and - {{IndexSizeError}} for out-of-bounds offsets.
    +
    Sets the endpoints to [startOffset, endOffset] within + element's value string. Throws {{NotSupportedError}} for + unsupported elements and {{IndexSizeError}} for out-of-bounds offsets.

    A {{FormControlRange}} is a range whose boundary points are defined in the -host text control’s value string rather than in the node tree. Its +host text control's value string rather than in the node tree. Its start node and end node are always the host -<input> or <textarea>, and its offsets are indices into that +<input> or <textarea>, and its offsets are indices into that string.

    A {{FormControlRange}} has associated state:

    @@ -9942,74 +9945,94 @@ string.

    (a non-negative integer) -

    The {{AbstractRange/startContainer}} and {{AbstractRange/endContainer}} getters of a -{{FormControlRange}} return its control. The -{{AbstractRange/startOffset}} and {{AbstractRange/endOffset}} getters return its -start offset and end offset. -{{AbstractRange/collapsed}} is true if and only if the two offsets are equal.

    - -

    An {{Element}} el supports form control ranges if it is an {{HTMLTextAreaElement}}, -or an {{HTMLInputElement}} whose type +

    The startContainer getter steps are to return this’s +control.

    +

    The endContainer getter steps are to return this’s +control.

    +

    The startOffset getter steps are to return this’s +start offset.

    +

    The endOffset getter steps are to return this’s +end offset.

    +

    The collapsed getter steps are to return true if this’s +start offset equals this’s +end offset; otherwise false.

    + +

    An {{Element}} el supports form control range if it is an +{{HTMLTextAreaElement}}, or an {{HTMLInputElement}} whose type supports the selection APIs: "text", "search", "tel", "url", or "password".

    -

    For a supported host element el, its value string is the same string exposed by -its IDL attribute {{HTMLTextAreaElement/value}}/{{HTMLInputElement/value}}. Offsets for +

    For a supported host element el, its +value string is the same string exposed by its IDL attribute +{{HTMLTextAreaElement/value}}/{{HTMLInputElement/value}}. Offsets for {{FormControlRange}} are indices into this string in the inclusive range [0, value.length], matching {{HTMLTextAreaElement/selectionStart}}/{{HTMLTextAreaElement/selectionEnd}} and {{HTMLInputElement/selectionStart}}/{{HTMLInputElement/selectionEnd}} units.

    The -new FormControlRange() constructor steps are to set this’s +new FormControlRange() constructor steps are to set this’s control to null and its start offset and end offset to 0.

    The -setFormControlRange(element, start, end) +setFormControlRange(element, startOffset, endOffset) method steps are:

      -
    1. If element does not support form control ranges, then throw a - "{{NotSupportedError!!exception}}" {{DOMException}}.
    2. +
    3. If element does not support form control range, then + throw a "{{NotSupportedError!!exception}}" {{DOMException}}.
    4. Let len be the length of element’s value string.
    5. -
    6. If start > len or end > len, then - throw an "{{IndexSizeError!!exception}}" {{DOMException}}.
    7. -
    8. If start > end, then set end to start.
    9. -
    10. Set control to element, - start offset to start, and - end offset to end.
    11. -
    +
  • If startOffset > len or endOffset > + len, then throw an "{{IndexSizeError!!exception}}" {{DOMException}}.
  • +
  • If startOffset > endOffset, then set endOffset to + startOffset.
  • +
  • Set this’s control to element, + this’s start offset to startOffset, and + this’s end offset to endOffset.
  • + + +

    If an {{HTMLInputElement}}’s type changes to a type that does not +support form control range (e.g., switching to date), then each +associated {{FormControlRange}} must set its +control to null and set both its +start offset and end offset to 0.

    -

    A {{FormControlRange}} is live: 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.

    +

    A {{FormControlRange}} is live: 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.

    • Edits before the range: Offsets shift by the net length change.
    • Edits after the range: Offsets remain unchanged.
    • -
    • Edits overlapping the range: If a boundary falls inside text that was removed, - move it to the start of the change. If the edit also inserted new text, remap the boundary - into the inserted span at the closest corresponding offset, not exceeding its end.
    • -
    • Insertion at the start boundary: A non-{{AbstractRange/collapsed}} range expands - to include the new text. A collapsed range (caret) moves after the insertion.
    • -
    • Insertion at the end boundary: A non-collapsed range does not expand to include - the new text. A collapsed range moves after the insertion.
    • +
    • Edits overlapping the range: If a boundary falls inside text that was removed, move it to the + start of the change. If the edit also inserted new text, remap the boundary into the inserted + span at the closest corresponding offset, not exceeding its end.
    • +
    • Insertion at the start boundary: A non-{{AbstractRange/collapsed}} range expands to include the + new text. A collapsed range (caret) moves after the insertion.
    • +
    • Insertion at the end boundary: A non-collapsed range does not expand to include the new text. A + collapsed range moves after the insertion.
    • Clamping and collapse: Offsets are clamped to the current value length. If the {{AbstractRange/startOffset}} would exceed the {{AbstractRange/endOffset}}, set the end to the start.
    -

    The stringification behavior must run these steps:

    + + +

    The stringification +behavior must run these steps:

      -
    1. If control is null, then return the empty string.

      -
    2. Let value be control's value string.

      -
    3. Let start be start offset, and let end be min(end offset, value.length).

      -
    4. If startend, then return the empty string.

      -
    5. Return the substring of value from start to end.

      +
    6. If this’s control is null, then return the empty string.
    7. +
    8. Let value be this’s control’s value string.
    9. +
    10. Let start be this’s start offset, and + let end be this’s end offset.
    11. +
    12. If startend, then return the empty string.
    13. +
    14. Return the substring of value from start to end.
    From e5b33612dd48eb74c226d46ee8921b40f8e9722c Mon Sep 17 00:00:00 2001 From: Stephanie Zhang Date: Mon, 29 Sep 2025 11:59:15 -0500 Subject: [PATCH 4/7] formatting --- dom.bs | 184 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 101 insertions(+), 83 deletions(-) diff --git a/dom.bs b/dom.bs index a0d2f1af..1c2062f5 100644 --- a/dom.bs +++ b/dom.bs @@ -4,7 +4,6 @@ H1: DOM Shortname: dom Text Macro: TWITTER thedomstandard Text Macro: LATESTRD 2025-06 -Text Macro: COMMIT-SHA 0000000 Abstract: DOM defines a platform-neutral model for events, aborting activities, and node trees. Translation: ja https://triple-underscore.github.io/DOM4-ja.html Translation: zh-Hans https://htmlspecs.com/dom/ @@ -9901,8 +9900,9 @@ interface FormControlRange : AbstractRange { constructor(); undefined setFormControlRange((HTMLInputElement or HTMLTextAreaElement) element, - unsigned long startOffset, - unsigned long endOffset); + unsigned long startOffset, + unsigned long endOffset + ); @@ -9912,111 +9912,123 @@ interface FormControlRange : AbstractRange { };
    -

    Objects implementing the {{FormControlRange}} interface are known as -{{FormControlRange}} objects.

    +

    Objects implementing the {{FormControlRange}} interface are known as {{FormControlRange}} objects.

    formControlRange = new FormControlRange() -
    Returns a new {{FormControlRange}} that tracks text offsets in a text - control's value as it changes. +
    Returns a new {{FormControlRange}} that tracks text offsets in a text control's value as it + changes. -
    formControlRange . +
    formControlRange. {{FormControlRange/setFormControlRange()}}(element, startOffset, endOffset) -
    Sets the endpoints to [startOffset, endOffset] within - element's value string. Throws {{NotSupportedError}} for - unsupported elements and {{IndexSizeError}} for out-of-bounds offsets. +
    Sets the endpoints to [startOffset, endOffset] within element's + value string. Throws {{NotSupportedError}} for unsupported elements and {{IndexSizeError}} + for out-of-bounds offsets.
    -

    A {{FormControlRange}} is a range whose boundary points are defined in the -host text control's value string rather than in the node tree. Its -start node and end node are always the host -<input> or <textarea>, and its offsets are indices into that -string.

    +

    A {{FormControlRange}} is a range whose boundary points are defined in the host text +control's value string rather than in the node tree. Its start node +and end node are always the host <input> or <textarea>, +and its offsets are indices into that string. + +

    A {{FormControlRange}} has associated state: -

    A {{FormControlRange}} has associated state:

      -
    • control - (null or an {{HTMLInputElement}}/{{HTMLTextAreaElement}})
    • -
    • start offset - (a non-negative integer)
    • -
    • end offset - (a non-negative integer)
    • +
    • control (null or an + {{HTMLInputElement}}/{{HTMLTextAreaElement}}). + +

    • start offset (a + non-negative integer). + +

    • end offset (a non-negative + integer).

    -

    The startContainer getter steps are to return this’s -control.

    -

    The endContainer getter steps are to return this’s -control.

    -

    The startOffset getter steps are to return this’s -start offset.

    -

    The endOffset getter steps are to return this’s -end offset.

    -

    The collapsed getter steps are to return true if this’s -start offset equals this’s -end offset; otherwise false.

    +

    The startContainer getter steps are to return this's +control. + +

    The endContainer getter steps are to return this's +control. + +

    The startOffset getter steps are to return this's +start offset. + +

    The endOffset getter steps are to return this's +end offset. + +

    The collapsed getter steps are to return true if this's +start offset equals this's +end offset; otherwise false.

    An {{Element}} el supports form control range if it is an {{HTMLTextAreaElement}}, or an {{HTMLInputElement}} whose type -supports the selection APIs: -"text", "search", "tel", "url", or -"password".

    +supports the selection +APIs: "text", "search", "tel", "url", or +"password".

    For a supported host element el, its value string is the same string exposed by its IDL attribute -{{HTMLTextAreaElement/value}}/{{HTMLInputElement/value}}. Offsets for -{{FormControlRange}} are indices into this string in the inclusive range -[0, value.length], matching +{{HTMLTextAreaElement/value}}/{{HTMLInputElement/value}}. Offsets for {{FormControlRange}} are +indices into this string in the inclusive range [0, value.length], matching {{HTMLTextAreaElement/selectionStart}}/{{HTMLTextAreaElement/selectionEnd}} and -{{HTMLInputElement/selectionStart}}/{{HTMLInputElement/selectionEnd}} units.

    +{{HTMLInputElement/selectionStart}}/{{HTMLInputElement/selectionEnd}} units.

    The -new FormControlRange() constructor steps are to set this’s -control to null and its -start offset and end offset to 0.

    +new FormControlRange() constructor steps are to set this's +control to null and its start offset and +end offset to 0.

    The -setFormControlRange(element, startOffset, endOffset) -method steps are:

    +setFormControlRange(element, startOffset, +endOffset) method steps are:
      -
    1. If element does not support form control range, then - throw a "{{NotSupportedError!!exception}}" {{DOMException}}.
    2. -
    3. Let len be the length of element’s value string.
    4. -
    5. If startOffset > len or endOffset > - len, then throw an "{{IndexSizeError!!exception}}" {{DOMException}}.
    6. -
    7. If startOffset > endOffset, then set endOffset to - startOffset.
    8. -
    9. Set this’s control to element, - this’s start offset to startOffset, and - this’s end offset to endOffset.
    10. +
    11. If element does not support form control range, then throw a + "{{NotSupportedError!!exception}}" {{DOMException}}. + +

    12. Let len be the length of element's value string. + +

    13. If startOffset > len or endOffset > len, + then throw an "{{IndexSizeError!!exception}}" {{DOMException}}. + +

    14. If startOffset > endOffset, then set endOffset to + startOffset. + +

    15. Set this's control to element, + this's start offset to startOffset, and + this's end offset to endOffset.

    -

    If an {{HTMLInputElement}}’s type changes to a type that does not -support form control range (e.g., switching to date), then each -associated {{FormControlRange}} must set its -control to null and set both its -start offset and end offset to 0.

    +

    If an {{HTMLInputElement}}'s type changes to a type that does not +support form control range (e.g., switching to date), then each associated +{{FormControlRange}} must set its control to null and set both its +start offset and end offset to 0.

    A {{FormControlRange}} is live: 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.

    +{{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.
      -
    • Edits before the range: Offsets shift by the net length change.
    • -
    • Edits after the range: Offsets remain unchanged.
    • -
    • Edits overlapping the range: If a boundary falls inside text that was removed, move it to the - start of the change. If the edit also inserted new text, remap the boundary into the inserted - span at the closest corresponding offset, not exceeding its end.
    • -
    • Insertion at the start boundary: A non-{{AbstractRange/collapsed}} range expands to include the - new text. A collapsed range (caret) moves after the insertion.
    • -
    • Insertion at the end boundary: A non-collapsed range does not expand to include the new text. A - collapsed range moves after the insertion.
    • -
    • Clamping and collapse: Offsets are clamped to the current value length. If the - {{AbstractRange/startOffset}} would exceed the {{AbstractRange/endOffset}}, set the end to the - start.
    • +
    • Edits before the range: Offsets shift by the net length change. + +

    • Edits after the range: Offsets remain unchanged. + +

    • Edits overlapping the range: If a boundary falls inside text that was removed, move it to the + start of the change. If the edit also inserted new text, remap the boundary into the inserted span + at the closest corresponding offset, not exceeding its end. + +

    • Insertion at the start boundary: A non-{{AbstractRange/collapsed}} range expands to include + the new text. A collapsed range (caret) moves after the insertion. + +

    • Insertion at the end boundary: A non-collapsed range does not expand to include the new text. + A collapsed range moves after the insertion. + +

    • Clamping and collapse: Offsets are clamped to the current value length. If the + {{AbstractRange/startOffset}} would exceed the {{AbstractRange/endOffset}}, set the end to the + start.

    The stringification -behavior must run these steps:

    +behavior must run these steps:
      -
    1. If this’s control is null, then return the empty string.
    2. -
    3. Let value be this’s control’s value string.
    4. -
    5. Let start be this’s start offset, and - let end be this’s end offset.
    6. -
    7. If startend, then return the empty string.
    8. -
    9. Return the substring of value from start to end.
    10. +
    11. If this's control is null, then return the empty + string. + +

    12. Let value be this's control's value + string. + +

    13. Let start be this's start offset, and let + end be this's end offset. + +

    14. If startend, then return the empty string. + +

    15. Return the substring of value from start to end.

    From 55b34b7986128ec595f70f8d69eb7c16794d8f3c Mon Sep 17 00:00:00 2001 From: Stephanie Zhang Date: Mon, 29 Sep 2025 13:19:52 -0500 Subject: [PATCH 5/7] pt 2 of Dan's comments --- dom.bs | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/dom.bs b/dom.bs index 1c2062f5..f1cc4cd6 100644 --- a/dom.bs +++ b/dom.bs @@ -4,6 +4,7 @@ H1: DOM Shortname: dom Text Macro: TWITTER thedomstandard Text Macro: LATESTRD 2025-06 +Text Macro: COMMIT-SHA 0000000 Abstract: DOM defines a platform-neutral model for events, aborting activities, and node trees. Translation: ja https://triple-underscore.github.io/DOM4-ja.html Translation: zh-Hans https://htmlspecs.com/dom/ @@ -9946,40 +9947,40 @@ and its offsets are indices into that string. integer). -

    The startContainer getter steps are to return this's +

    The startContainer getter steps are to return this's control. -

    The endContainer getter steps are to return this's +

    The endContainer getter steps are to return this's control. -

    The startOffset getter steps are to return this's +

    The startOffset getter steps are to return this's start offset. -

    The endOffset getter steps are to return this's +

    The endOffset getter steps are to return this's end offset. -

    The collapsed getter steps are to return true if this's -start offset equals this's +

    The collapsed getter steps are to return true if this's +start offset equals this's end offset; otherwise false.

    An {{Element}} el supports form control range if it is an -{{HTMLTextAreaElement}}, or an {{HTMLInputElement}} whose type +{{HTMLInputElement}}, or an {{HTMLTextAreaElement}} whose type supports the selection APIs: "text", "search", "tel", "url", or "password". -

    For a supported host element el, its -value string is the same string exposed by its IDL attribute -{{HTMLTextAreaElement/value}}/{{HTMLInputElement/value}}. Offsets for {{FormControlRange}} are -indices into this string in the inclusive range [0, value.length], matching -{{HTMLTextAreaElement/selectionStart}}/{{HTMLTextAreaElement/selectionEnd}} and -{{HTMLInputElement/selectionStart}}/{{HTMLInputElement/selectionEnd}} units. -

    The -new FormControlRange() constructor steps are to set this's +new FormControlRange() constructor steps are to set this's control to null and its start offset and end offset to 0. +

    For a supported host element el, its +value string is the same string exposed by its IDL attribute +{{HTMLInputElement/value}}/{{HTMLTextAreaElement/value}}. Offsets for {{FormControlRange}} are +indices into this string in the inclusive range [0, value.length], matching +{{HTMLInputElement/selectionStart}}/{{HTMLInputElement/selectionEnd}} and +{{HTMLTextAreaElement/selectionStart}}/{{HTMLTextAreaElement/selectionEnd}} units. +

    The setFormControlRange(element, startOffset, endOffset) method steps are: @@ -9996,9 +9997,9 @@ indices into this string in the inclusive range [0, value.length],

  • If startOffset > endOffset, then set endOffset to startOffset. -

  • Set this's control to element, - this's start offset to startOffset, and - this's end offset to endOffset. +

  • Set this's control to element, + this's start offset to startOffset, and + this's end offset to endOffset.

    If an {{HTMLInputElement}}'s type changes to a type that does not @@ -10039,14 +10040,14 @@ applied to the UTF-16 code units of a form control's value. behavior must run these steps:

      -
    1. If this's control is null, then return the empty +

    2. If this's control is null, then return the empty string. -

    3. Let value be this's control's value +

    4. Let value be this's control's value string. -

    5. Let start be this's start offset, and let - end be this's end offset. +

    6. Let start be this's start offset, and let + end be this's end offset.

    7. If startend, then return the empty string. From 98585990b0ee8bc14fdbd4822dbf35374fbc9725 Mon Sep 17 00:00:00 2001 From: Stephanie Zhang Date: Mon, 29 Sep 2025 13:50:21 -0500 Subject: [PATCH 6/7] remove commit-sha --- dom.bs | 1 - 1 file changed, 1 deletion(-) diff --git a/dom.bs b/dom.bs index f1cc4cd6..b67d2205 100644 --- a/dom.bs +++ b/dom.bs @@ -4,7 +4,6 @@ H1: DOM Shortname: dom Text Macro: TWITTER thedomstandard Text Macro: LATESTRD 2025-06 -Text Macro: COMMIT-SHA 0000000 Abstract: DOM defines a platform-neutral model for events, aborting activities, and node trees. Translation: ja https://triple-underscore.github.io/DOM4-ja.html Translation: zh-Hans https://htmlspecs.com/dom/ From f65c4479e69a6946fb305f5d44046e210e700caa Mon Sep 17 00:00:00 2001 From: Stephanie Zhang Date: Wed, 1 Oct 2025 13:34:53 -0500 Subject: [PATCH 7/7] fixes for dan's comments --- dom.bs | 68 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/dom.bs b/dom.bs index b67d2205..13be0006 100644 --- a/dom.bs +++ b/dom.bs @@ -4,6 +4,7 @@ H1: DOM Shortname: dom Text Macro: TWITTER thedomstandard Text Macro: LATESTRD 2025-06 +Text Macro: COMMIT-SHA 0000000 Abstract: DOM defines a platform-neutral model for events, aborting activities, and node trees. Translation: ja https://triple-underscore.github.io/DOM4-ja.html Translation: zh-Hans https://htmlspecs.com/dom/ @@ -9904,7 +9905,9 @@ interface FormControlRange : AbstractRange { unsigned long endOffset ); + setFormControl, setControl, setStartAndEnd, or simply set. Tracked as an + Open Question in the explainer: + https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/FormControlRange/explainer.md#open-questions --> DOMRectList getClientRects(); DOMRect getBoundingClientRect(); @@ -9924,14 +9927,14 @@ interface FormControlRange : AbstractRange { {{FormControlRange/setFormControlRange()}}(element, startOffset, endOffset)

      Sets the endpoints to [startOffset, endOffset] within element's - value string. Throws {{NotSupportedError}} for unsupported elements and {{IndexSizeError}} - for out-of-bounds offsets. +value string. Throws {{NotSupportedError}} for +unsupported elements and {{IndexSizeError}} for out-of-bounds offsets.

      A {{FormControlRange}} is a range whose boundary points are defined in the host text -control's value string rather than in the node tree. Its start node -and end node are always the host <input> or <textarea>, -and its offsets are indices into that string. +control's value string rather than in the node tree. +Its start node and end node are always the host <input> +or <textarea>, and its offsets are indices into that string.

      A {{FormControlRange}} has associated state: @@ -9962,23 +9965,29 @@ and its offsets are indices into that string. start offset equals this's end offset; otherwise false. -

      An {{Element}} el supports form control range if it is an -{{HTMLInputElement}}, or an {{HTMLTextAreaElement}} whose type -supports the selection -APIs: "text", "search", "tel", "url", or +

      An {{Element}} el +supports form control range if it is an +{{HTMLTextAreaElement}}, or an {{HTMLInputElement}} whose type is one of +"text", "search", "tel", "url", or "password". +

      These are exactly the types for which the related selection APIs +apply in HTML; see +selection APIs applicability for input types. +This list is the complement of that section.

      +

      The new FormControlRange() constructor steps are to set this's control to null and its start offset and end offset to 0.

      For a supported host element el, its -value string is the same string exposed by its IDL attribute -{{HTMLInputElement/value}}/{{HTMLTextAreaElement/value}}. Offsets for {{FormControlRange}} are -indices into this string in the inclusive range [0, value.length], matching +value string is the same string exposed by its IDL +attribute {{HTMLInputElement/value}}/{{HTMLTextAreaElement/value}}. Offsets for {{FormControlRange}} +are indices into this value string in the inclusive +range [0, value.length], matching {{HTMLInputElement/selectionStart}}/{{HTMLInputElement/selectionEnd}} and -{{HTMLTextAreaElement/selectionStart}}/{{HTMLTextAreaElement/selectionEnd}} units. +{{HTMLTextAreaElement/selectionStart}}/{{HTMLTextAreaElement/selectionEnd}} units.

      The setFormControlRange(element, startOffset, @@ -9988,7 +9997,8 @@ indices into this string in the inclusive range [0, value.length],

    8. If element does not support form control range, then throw a "{{NotSupportedError!!exception}}" {{DOMException}}. -

    9. Let len be the length of element's value string. +

    10. Let len be the length of element's +value string.

    11. If startOffset > len or endOffset > len, then throw an "{{IndexSizeError!!exception}}" {{DOMException}}. @@ -10006,10 +10016,13 @@ indices into this string in the inclusive range [0, value.length], {{FormControlRange}} must set its control to null and set both its start offset and end offset to 0. -

      A {{FormControlRange}} is live: 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. +

      HTML will normatively call the associated range-adjustment algorithm wherever a +control’s value changes or its type ceases to support selection.

      + +

      A {{FormControlRange}} is live: 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.

      • Edits before the range: Offsets shift by the net length change. @@ -10036,21 +10049,18 @@ applied to the UTF-16 code units of a form control's value. control value changes (similar to Range update handling in DOM). -->

        The stringification -behavior must run these steps: +behavior must run these steps:

          -
        1. If this's control is null, then return the empty - string. - -

        2. Let value be this's control's value - string. +

        3. If this's control is null, then return the empty string.

        4. -
        5. Let start be this's start offset, and let - end be this's end offset. +

        6. Let value be this's control's + value string.

        7. -
        8. If startend, then return the empty string. +

        9. Let start be this's start offset, and let + end be this's end offset.

        10. -
        11. Return the substring of value from start to end. +

        12. Return the substring of value from start to end.