diff --git a/index.html b/index.html index 4854fbc..9556396 100644 --- a/index.html +++ b/index.html @@ -37,7 +37,7 @@ This document defines APIs for selection, which allows users and authors to select a portion of a document or specify a point of interest for copy, paste, and other editing operations.

- +

Any feedback or discussion of this specification should be sent to the public-webapps mailing list @@ -110,7 +110,7 @@

Definition

inside a document cannot have a selection

Each selection can be associated with a single range. - When there is no range associated with the selection, the selection is empty. + When there is no range associated with the selection, the selection is empty. The selection must be initially empty.

A document's selection is a singleton object associated with that document, @@ -244,7 +244,7 @@

Selection interface

IE9 and Firefox 4.0 return the same object every time, as the spec says. Chrome 12 dev and Opera 11.10 return a different object every time.

- +
addRange

The method must follow these steps:

@@ -274,7 +274,7 @@

Selection interface

Firefox 51 changes its selection if the range is modified.

- +
removeRange

The method must make the context object empty by disassociating its range @@ -384,6 +384,7 @@

Selection interface

  • Set the context object's range to newRange.
  • If focus is before anchor, set context object's direction to backwards. Otherwise, set it to forwards
  • +
    selectAllChildren
    @@ -397,7 +398,7 @@

    Selection interface

  • Set the context object's range to newRange.
  • Set the context object's direction to forwards.
  • - +

    Based mostly on Firefox 9.0a2. It has a bug that I didn't reproduce, namely that if you pass a Document as the argument, the end offset becomes 1 instead @@ -422,10 +423,10 @@

    Selection interface

    deleteFromDocument
    -

    The method must invoke deleteContents() ([[!DOM]]) +

    The method must invoke deleteContents() ([[DOM]]) on the context object's range if the context object is not empty. Otherwise the method must do nothing.

    - +

    This is the one method that actually mutates the range instead of replacing it. This matches IE9 and Firefox 12.0a1. (Chrome 17 dev and Opera Next 12.00 alpha can't be tested, because getRangeAt() returns a copy anyway.)

    @@ -526,7 +527,8 @@

    Extensions to Window interface

    getSelection()
    -

    The method must invoke and return the result of getSelection on the context object's +

    The method must invoke and return the result of + getSelection on the context object's document ([[!HTML]]) property.

    @@ -571,7 +573,7 @@

    User Interactions

    The user agent should allow the user to change the selection associated with the active document (defined in [[!HTML]]). If the user makes any modification to a selection, the user agent must create a new range with suitable - start and + start and end of the range ([[!DOM]]) and associate the selection with this new range (not modify the existing range), and set update selection's direction to forwards if the start is before or equal to the end, @@ -591,9 +593,9 @@

    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 ([[!DOM]]) - an event with the name selectstart, which bubbles and is cancelable, - at the node associated with the boundary point of newRange's start - prior to changing the selection if the selection was previously empty + an event with the name selectstart, which bubbles and is + cancelable, at the node associated with the boundary point of newRange's + start prior to changing the selection if the selection was previously empty or the previously associated range was collapsed.

    If the event is canceled, the user agent must not change the selection.

    @@ -607,8 +609,8 @@

    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 queue a task - to fire an event with the name selectionchange, which does not bubble and is not cancelable, - at the document associated with the selection.

    + to fire an event with the name selectionchange, which does not bubble and is not + cancelable, at the document associated with the selection.

    @@ -617,14 +619,15 @@

    selectionchange event

    Acknowledgements

    Many thanks to