diff --git a/index.html b/index.html index 075070d..ac42cb1 100644 --- a/index.html +++ b/index.html @@ -180,6 +180,10 @@

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. +

@@ -957,20 +961,46 @@

When the selection is dissociated with its range, - associated with a new range or the associated range's + 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 queue a task on the user interaction task source - to fire an event named selectionchange, - which does not bubble and is not cancelable, - at the document associated with the selection. + 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 queue a task on the user interaction task source - to fire an event named selectionchange, - which bubbles but is not cancelable, at the element. + 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:

+
    +
  1. + If target's has scheduled selectionchange event is true, + abort these steps. +
  2. +
  3. + Queue a task on the user interaction task source to + fire a selectionchange event on target. +
  4. +
+
+
+

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. +
  3. + If target is an element, fire an event named selectionchange, + which bubbles and not cancelable, at target. +
  4. +
  5. + Otherwise, if target is a document, fire an event named selectionchange, + which does not bubble and not cancelable, at target. +
  6. +
+