From 45f8fe831f5c6231f941f845071c770e7b9bbe76 Mon Sep 17 00:00:00 2001 From: siusin Date: Thu, 26 Sep 2024 21:55:14 +0000 Subject: [PATCH] chore: tidy up index.html --- index.html | 325 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 193 insertions(+), 132 deletions(-) diff --git a/index.html b/index.html index 5e6278f..cc5fa85 100644 --- a/index.html +++ b/index.html @@ -144,10 +144,10 @@

If the selection's range is not null and is [=range/collapsed=], then the caret position must be at that range's boundary point. When the selection is not - [=range/collapsed=], this specification does not define the caret position; user - agents should follow platform conventions in deciding whether the caret - is at the start of the selection, the end of the - selection, or somewhere else. + [=range/collapsed=], this specification does not define the caret + position; user agents should follow platform conventions in deciding + whether the caret is at the start of the selection, the end of + the selection, or somewhere else.

Each selection has a direction: forwards, @@ -162,9 +162,9 @@

forwards. Otherwise, it must be directionless.

- When the selection's range is mutated by scripts, - e.g. via {{Range/selectNode(node)}}, direction of the selection - must be preserved. + When the selection's range is mutated by scripts, e.g. + via {{Range/selectNode(node)}}, direction of the + selection must be preserved.

Each selections also have an anchor and a @@ -176,13 +176,14 @@

[=range/start=] and its anchor is the [=range/end=].

- anchor and focus of selection need not to be - in the [=document tree=]. It could be in a [=shadow tree=] of - the same [=document=]. + anchor and focus of selection need not to be in + the [=document tree=]. It could be in a [=shadow tree=] of the same + [=document=].

- Each document, input element, and textarea element has a boolean - has scheduled selectionchange event, which is initially false. + Each document, input element, and textarea element + has a boolean has scheduled selectionchange event, which is + initially false.

@@ -230,8 +231,8 @@

The attribute must return the anchor [=boundary point/node=] - of [=this=], or `null` if the anchor is null or anchor - is not in the [=document tree=]. + of [=this=], or `null` if the anchor is null or + anchor is not in the [=document tree=].

@@ -290,9 +291,9 @@

The attribute must return `"None"` if [=this=] is empty or - either focus or anchor is not in the [=document tree=], - `"Caret"` if [=this=]'s range is [=range/collapsed=], and - `"Range"` otherwise. + either focus or anchor is not in the [=document + tree=], `"Caret"` if [=this=]'s range is + [=range/collapsed=], and `"Range"` otherwise.

@@ -301,9 +302,9 @@

The attribute must return `"none"` if [=this=] is empty or - this selection is directionless. `"forward"` if this selection's - direction is forwards and `"backward"` if this selection's - direction is backwards. + this selection is directionless. `"forward"` if this + selection's direction is forwards and `"backward"` if this + selection's direction is backwards.

@@ -314,8 +315,8 @@

The method must throw an {{IndexSizeError}} exception if index is not 0, or if [=this=] is empty or either focus or anchor is not in the - [=document tree=]. Otherwise, it must return a reference to (not a copy - of) [=this=]'s range. + [=document tree=]. Otherwise, it must return a reference to (not a + copy of) [=this=]'s range.

Thus subsequent calls of this method returns the same range @@ -401,29 +402,49 @@

    -
  1. If [=this=] is empty, return an empty array.
  2. -
  3. Otherwise, let startNode be [=range/start node=] of the [=range=] associated with [=this=], - and let startOffset be [=range/start offset=] of the [=range=].
  4. -
  5. While startNode is a [=node=], startNode's [=tree/root=] is a [=shadow root=], - and startNode's [=tree/root=] is not a [=shadow-including inclusive ancestor=] of any of shadowRoots, - repeat these steps: +
  6. If [=this=] is empty, return an empty array. +
  7. +
  8. Otherwise, let startNode be [=range/start node=] of + the [=range=] associated with [=this=], and let + startOffset be [=range/start offset=] of the [=range=]. +
  9. +
  10. While startNode is a [=node=], + startNode's [=tree/root=] is a [=shadow root=], and + startNode's [=tree/root=] is not a [=shadow-including + inclusive ancestor=] of any of shadowRoots, repeat these + steps:
      -
    1. Set startOffset to [=tree/index=] of startNode's [=tree/root=]'s [=host=].
    2. -
    3. Set startNode to startNode's [=tree/root=]'s [=host=]'s [=tree/parent=].
    4. +
    5. Set startOffset to [=tree/index=] of + startNode's [=tree/root=]'s [=host=]. +
    6. +
    7. Set startNode to startNode's + [=tree/root=]'s [=host=]'s [=tree/parent=]. +
  11. -
  12. Let endNode be [=range/end node=] of the [=range=] associated with [=this=], - and let endOffset be [=range/end offset=] of the [=range=].
  13. -
  14. While endNode is a [=node=], endNode's [=tree/root=] is a [=shadow root=], - and endNode's [=tree/root=] is not a [=shadow-including inclusive ancestor=] of any of shadowRoots, - repeat these steps: +
  15. Let endNode be [=range/end node=] of the [=range=] + associated with [=this=], and let endOffset be + [=range/end offset=] of the [=range=]. +
  16. +
  17. While endNode is a [=node=], endNode's + [=tree/root=] is a [=shadow root=], and endNode's + [=tree/root=] is not a [=shadow-including inclusive ancestor=] of + any of shadowRoots, repeat these steps:
      -
    1. Set endOffset to [=tree/index=] of endNode's [=tree/root=]'s [=host=] plus 1.
    2. -
    3. Set endNode to endNode's [=tree/root=]'s [=host=]'s [=tree/parent=].
    4. +
    5. Set endOffset to [=tree/index=] of + endNode's [=tree/root=]'s [=host=] plus 1. +
    6. +
    7. Set endNode to endNode's + [=tree/root=]'s [=host=]'s [=tree/parent=]. +
  18. -
  19. Return an array consisting of new {{StaticRange}} whose [=range/start node=] is startNode, [=range/start offset=] - is startOffset, [=range/end node=] is endNode, and [=range/end offset=] is endOffset.
  20. +
  21. Return an array consisting of new {{StaticRange}} whose + [=range/start node=] is startNode, [=range/start + offset=] is startOffset, [=range/end node=] is + endNode, and [=range/end offset=] is + endOffset. +
@@ -441,9 +462,9 @@

offset is longer than node's [=Node/length=] and abort these steps. -
  • - If document associated with [=this=] is not a [=shadow-including inclusive ancestor=] - of node, abort these steps. +
  • If document associated with [=this=] is not a + [=shadow-including inclusive ancestor=] of node, abort + these steps.
  • Otherwise, let newRange be a new range.
  • @@ -503,9 +524,9 @@

    The method must follow these steps:

      -
    1. - If the document associated with [=this=] is not a [=shadow-including inclusive ancestor=] of - node, abort these steps. +
    2. If the document associated with [=this=] is not a + [=shadow-including inclusive ancestor=] of node, abort + these steps.
    3. If [=this=] is empty, throw an {{InvalidStateError}} exception and abort these steps. @@ -564,9 +585,9 @@

      [=Node/length=], throw an {{IndexSizeError}} exception and abort these steps.

    4. -
    5. - If document associated with [=this=] is not a [=shadow-including inclusive ancestor=] - of anchorNode or focusNode, abort these steps. +
    6. If document associated with [=this=] is not a + [=shadow-including inclusive ancestor=] of anchorNode or + focusNode, abort these steps.
    7. Let anchor be the boundary point (anchorNode, anchorOffset) and let @@ -645,46 +666,61 @@

      - modify() method + modify() method

      The method must follow these steps:

        -
      1. If alter is not ASCII case-insensitive match with - "extend" or "move", abort these steps.
      2. -
      3. If direction is not ASCII case-insensitive match with - "forward", "backward", "left", or "right", abort these steps.
      4. -
      5. If granularity is not ASCII case-insensitive match with - "character", "word", "sentence", "line", "paragraph", "lineboundary", - "sentenceboundary", "paragraphboundary", "documentboundary", abort these steps.
      6. -
      7. If this selection is empty, abort these steps.
      8. - -
      9. Let effectiveDirection be backwards.
      10. -
      11. If direction is ASCII case-insensitive match with "forward", - set effectiveDirection to forwards.
      12. -
      13. If direction is ASCII case-insensitive match with "right" - and [=inline base direction=] of this selection's focus is - ltr, - set effectiveDirection to forwards.
      14. -
      15. If direction is ASCII case-insensitive match with "left" - and [=inline base direction=] of this selection's focus is - rtl, - set effectiveDirection to forwards.
      16. - -
      17. Set this selection's direction to effectiveDirection.
      18. -
      19. - If alter is ASCII case-insensitive match with "extend", - set this selection's focus to the location - as if the user had requested to extend selection by granularity.
      20. -
      21. - Otherwise, set this selection's focus and anchor to the location - as if the user had requested to move selection by granularity. +
      22. If alter is not ASCII case-insensitive match + with "extend" or "move", abort these steps. +
      23. +
      24. If direction is not ASCII case-insensitive + match with "forward", "backward", "left", or "right", abort these + steps. +
      25. +
      26. If granularity is not ASCII case-insensitive + match with "character", "word", "sentence", "line", "paragraph", + "lineboundary", "sentenceboundary", "paragraphboundary", + "documentboundary", abort these steps. +
      27. +
      28. If this selection is empty, abort these steps. +
      29. +
      30. Let effectiveDirection be backwards. +
      31. +
      32. If direction is ASCII case-insensitive match + with "forward", set effectiveDirection to + forwards. +
      33. +
      34. If direction is ASCII case-insensitive match + with "right" and [=inline base direction=] of this + selection's focus is ltr, set + effectiveDirection to forwards. +
      35. +
      36. If direction is ASCII case-insensitive match + with "left" and [=inline base direction=] of this + selection's focus is rtl, set + effectiveDirection to forwards. +
      37. +
      38. Set this selection's direction to + effectiveDirection. +
      39. +
      40. If alter is ASCII case-insensitive match with + "extend", set this selection's focus to the + location as if the user had requested to extend selection by + granularity. +
      41. +
      42. Otherwise, set this selection's focus and + anchor to the location as if the user had requested to move + selection by granularity.

      - We need to more precisely define what it means to extend or move selection by each granularity. + We need to more precisely define what it means to extend or move + selection by each granularity.

      @@ -693,8 +729,9 @@

      The method must invoke {{Range/deleteContents()}} on [=this=]'s - range if [=this=] is not empty and both focus and anchor - are in the [=document tree=]. Otherwise the method must do nothing. + range if [=this=] is not empty and both focus + and anchor are in the [=document tree=]. Otherwise the + method must do nothing.

      This is the one method that actually mutates the range instead of @@ -726,20 +763,25 @@

      If allowPartialContainment is true, the method must return true if and only if [=range/start=] of its range is [=boundary point/before=] or visually - equivalent to the last boundary point in the - node and [=range/end=] of its - range is [=boundary point/after=] or visually equivalent to - the first boundary point in the node. + equivalent to the last boundary point in the node + and [=range/end=] of its range is + [=boundary point/after=] or visually equivalent to the first + boundary point in the node.

      stringifier
      -

      The stringification must return the string, which is the concatenation of - the rendered text if there is a [=range=] associated with [=this=].

      -

      If the selection is within a textarea or input element, - it must return the selected substring in its value.

      +

      + The stringification must return the string, which is the + concatenation of the rendered text if there is a [=range=] + associated with [=this=]. +

      +

      + If the selection is within a textarea or input + element, it must return the selected substring in its value. +

      @@ -885,21 +927,27 @@

      Responding to DOM Mutations

      - When the user agent is to [=replace data=] or [=CharacterData/substring data=] on {{CharacterData}}, - the user agent must update the range associated with selection of the [=Node/node document=] - of the {{CharacterData}} as if it's a live range. + When the user agent is to [=replace data=] or [=CharacterData/substring + data=] on {{CharacterData}}, the user agent must update the + range associated with selection of the [=Node/node + document=] of the {{CharacterData}} as if it's a live range.

      - When the user agent is to split a {{Text}} [=node=], the user agent must update the range associated with - selection of the [=Node/node document=] of the {{Text}} as if it's a live range. + When the user agent is to split a {{Text}} [=node=], the user agent + must update the range associated with selection of the + [=Node/node document=] of the {{Text}} as if it's a live range.

      - When the user agent is to run steps for normalize() method, the user agent must update - the range associated with selection of the [=Node/node document=] of [=this=] as if it's a live range. + When the user agent is to run steps for normalize() + method, the user agent must update the range associated with + selection of the [=Node/node document=] of [=this=] as if it's a + live range.

      - When the user agent is to [=remove=] or [=insert=] a [=node=], the user agent must update - the range associated with selection of the [=Node/node document=] of the [=node=] as if it's a live range. + When the user agent is to [=remove=] or [=insert=] a [=node=], the user + agent must update the range associated with selection of + the [=Node/node document=] of the [=node=] as if it's a live + range.

    @@ -908,9 +956,9 @@

    The user agent should allow the user to change the selection - associated with the [=navigable/active document=]. If the user makes any - modification to a selection, the user agent must create a new - range with suitable [=range/start=] and [=range/end=] of the + associated with the [=navigable/active document=]. If the user makes + any modification to a selection, the user agent must create a + new range with suitable [=range/start=] and [=range/end=] of the range and associate the selection with this new range (not modify the existing range), and set update selection's direction to forwards if the @@ -934,17 +982,17 @@

    - selectstart event + selectstart event

    When the user agent is about to associate a new range newRange to the selection in response to a user initiated action, the user agent must fire an event named - selectstart, which bubbles and is cancelable, at - the [=boundary point/node=] associated with the boundary point - of newRange's [=range/start=] prior to changing the - selection if the selection was previously empty or the - previously associated range was [=range/collapsed=]. + selectstart, which bubbles and is cancelable, at the + [=boundary point/node=] associated with the boundary point of + newRange's [=range/start=] prior to changing the selection + if the selection was previously empty or the previously + associated range was [=range/collapsed=].

    If the event is canceled, the user agent must not change the @@ -957,26 +1005,32 @@

    - selectionchange event + selectionchange event

    When the selection is dissociated with its range, associated with a new range, or the associated range's - boundary point is mutated either by the user or the content script, - the user agent must schedule a selectionchange event on document. + boundary point is mutated either by the user or the content + script, the user agent must schedule a selectionchange event + on document.

    When an [^input^] or [^textarea^] element provide a text selection - and its selection changes (in either extent or [=direction=]), - the user agent must schedule a selectionchange event on the element. + and its selection changes (in either extent or [=direction=]), the + user agent must schedule a selectionchange event on the + element.

    -

    Scheduling selectionhange event

    -

    To schedule a selectionchange event on a node target, run these steps:

    +

    + Scheduling selectionhange event +

    +

    + To schedule a selectionchange event on a node + target, run these steps: +

      -
    1. - If target's has scheduled selectionchange event is true, - abort these steps. +
    2. If target's has scheduled selectionchange + event is true, abort these steps.
    3. Queue a task on the user interaction task source to @@ -985,19 +1039,24 @@

      Scheduling selectionhange event

    -

    Firing selectionhange event

    -

    To fire a selectionchange event on a node target, run these steps:

    +

    + Firing selectionhange event +

    +

    + To fire a selectionchange event on a node + target, run these steps: +

      -
    1. - Set target's has scheduled selectionchange event to false. +
    2. Set target's has scheduled selectionchange + event to false.
    3. -
    4. - If target is an element, fire an event named selectionchange, - which bubbles and not cancelable, at target. +
    5. If target is an element, fire an event named + selectionchange, which bubbles and not cancelable, at + target.
    6. -
    7. - Otherwise, if target is a document, fire an event named selectionchange, - which does not bubble and not cancelable, at target. +
    8. Otherwise, if target is a document, fire an + event named selectionchange, which does not bubble + and not cancelable, at target.
    @@ -1006,8 +1065,8 @@

    Firing selectionhange event

    This specification defines conformance criteria that apply to a single - product: the user agent that implements the - interfaces that it contains. + product: the user agent that implements the interfaces that it + contains.

    @@ -1018,9 +1077,11 @@

    There are no known security considerations for this standard.

    - To mitigate potential privacy risks of exposing user's use of assistive technologies, for example, - user agent may elect to emulate mouse and keyboard events typically associated with - selectstart or selectionchange events when the user opts to modify the selection of a document. + To mitigate potential privacy risks of exposing user's use of assistive + technologies, for example, user agent may elect to emulate mouse + and keyboard events typically associated with selectstart or + selectionchange events when the user opts to modify the + selection of a document.