From 43163e8629f19554800d70bc345209dc2acd622b Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 2 Apr 2018 18:21:29 +1000 Subject: [PATCH 1/2] fixup some ReSpec issues --- index.html | 149 ++++++++++++++++++----------------------------------- 1 file changed, 49 insertions(+), 100 deletions(-) diff --git a/index.html b/index.html index 3bedb9c..3053f82 100644 --- a/index.html +++ b/index.html @@ -6,80 +6,23 @@ @@ -152,8 +95,8 @@

Background

Definition

-

Every document ([[!DOM4]]) with - a browsing context ([[!HTML5]]) +

Every document ([[!DOM]]) with + a browsing context ([[!HTML]]) has a unique selection associated with it.

This is a requirement of the HTML spec. @@ -163,10 +106,10 @@

Definition

This one selection must be shared by all the content of the document (though not by nested documents), including any editing hosts in the document. - Editing hosts (defined in [[!HTML5]]) that are not + Editing hosts that are not inside a document cannot have a selection

-

Each selection can be associated with a single range (defined in [[!DOM4]]). +

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

@@ -186,7 +129,7 @@

Definition

the selection must be associated with a new range object, as required elsewhere in this specification.

If the selection's range is not null and is - collapsed ([[!DOM4]]), + collapsed, then the caret position must be at that range's boundary point. When the selection is not empty, 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, @@ -197,9 +140,9 @@

Definition

Each selection has a direction, forwards, backwards, or directionless. If the user creates a selection by indicating first one boundary point of the range and then the other (such as by clicking on one point and dragging to another), - and the first indicated boundary point is after ([[!DOM4]]) the second, + and the first indicated boundary point is after ([[!DOM]]) the second, then the corresponding selection must initially be backwards. - If the first indicated boundary point is before ([[!DOM4]]) the second, + If the first indicated boundary point is before ([[!DOM]]) the second, then the corresponding selection must initially be forwards. Otherwise, it must be directionless.

@@ -239,20 +182,20 @@

Selection interface

[CEReactions] void deleteFromDocument(); boolean containsNode(Node node, optional boolean allowPartialContainment = false); - stringifier DOMString(); + stringifier DOMString (); };
anchorNode
-

The attribute must return the anchor node ([[!DOM4]]) - of the context object ([[!DOM4]]), +

The attribute must return the anchor node ([[!DOM]]) + of the context object ([[!DOM]]), or null if the anchor is null.

anchorOffset
-

The attribute must return the anchor offset ([[!DOM4]]) +

The attribute must return the anchor offset ([[!DOM]]) of the context object, or 0 if the anchor is null.

@@ -289,7 +232,7 @@

Selection interface

getRangeAt
-

The method must throw an IndexSizeError ([[!DOM4]]) exception +

The method must throw an IndexSizeError ([[!DOM]]) exception if index is not 0, or if the context object is empty. Otherwise, it must return a reference to (not a copy of) the context object's range.

@@ -306,7 +249,7 @@

Selection interface

The method must follow these steps:

    -
  1. If the root ([[!DOM4]]) +
  2. If the root ([[!DOM]]) of the range's boundary points are not the document associated with context object, abort these steps.
  3. If rangeCount is not 0, abort these steps.
  4. @@ -357,10 +300,10 @@

    Selection interface

    1. If node is null, this method must behave identically as removeAllRanges() and abort these steps.
    2. The method must throw an IndexSizeError exception if offset is longer than node's - length ([[!DOM4]]) and abort these steps.
    3. + length ([[!DOM]]) and abort these steps.
    4. If node's root is not the document associated with the context object, abort these steps.
    5. Otherwise, let newRange be a new range.
    6. -
    7. Set ([[!DOM4]]) +
    8. Set ([[!DOM]]) the start and the end of newRange to (node, offset).
    9. Set the context object's range to newRange.
    @@ -373,7 +316,7 @@

    Selection interface

    collapseToStart
    -

    The method must throw InvalidStateError ([[!DOM4]]) exception +

    The method must throw InvalidStateError ([[!DOM]]) exception if the context object is empty. Otherwise, it must create a new range, set both its start and end to the start of the context object's range, @@ -479,7 +422,7 @@

    Selection interface

    deleteFromDocument
    -

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

    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.

    @@ -518,7 +461,7 @@

    Selection interface

    This spec doesn't have everything from there yet, in particular selectionLanguageChange() and containsNode() are missing. They are missing because I couldn't work out how to define them in terms of Ranges.

    -
    +

    Originally, the Selection interface was a Netscape feature. The original implementation was carried on into Gecko (Firefox), and the feature was later implemented independently by other browser engines. The Netscape implementation always allowed multiple ranges in a single selection, for instance so the user could select a column of a table @@ -530,11 +473,11 @@

    Selection interface

    but the API was still originally designed for selections with arbitrary numbers of ranges. This explains oddities like the coexistence of removeRange() and removeAllRanges(), and a getRangeAt() method that takes an integer argument that must always be zero.

    -
    +

    All of the members of the Selection interface are defined in terms of operations on the range object (if any) represented by the object. - These operations can raise exceptions, as defined for the Range ([[!DOM4]]) interface; + These operations can raise exceptions, as defined for the Range ([[!DOM]]) interface; this can therefore result in the members of the Selection interface raising exceptions as well, in addition to any explicitly called out below.

@@ -553,7 +496,7 @@

Extensions to Document interface

};
-
getSelection
+
getSelection()

The method must return the selection associated with context object if the context object has an associated browsing context, @@ -572,22 +515,28 @@

Extensions to Document interface

Extensions to Window interface

+

+ The Window interface is defined in [[!HTML]]. +

           partial interface Window {
             Selection? getSelection();
           };
         
-
getSelection
+
getSelection()

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

+ document ([[!HTML]]) property.

Extensions to GlobalEventHandlers

+

+ The GlobalEventHandlers interface is defined in [[!HTML]]. +

           partial interface GlobalEventHandlers {
             attribute EventHandler onselectstart;
@@ -620,10 +569,10 @@ 

Extensions to GlobalEventHandlers

User Interactions

The user agent should allow the user to change the selection associated with the active document - (defined in [[!HTML5]]). + (defined in [[!HTML]]). If the user makes any modification to a selection, the user agent must create a new range with suitable start and - end of the range ([[!DOM4]]) + 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, backwards if if the end is before the start, @@ -641,7 +590,7 @@

User Interactions

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 ([[!DOM4]]) + 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 From e0b1c1881b1274f797b73f9fdad790aba9767727 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 2 Apr 2018 18:23:04 +1000 Subject: [PATCH 2/2] Enable PR previews --- .pr-preview.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .pr-preview.json diff --git a/.pr-preview.json b/.pr-preview.json new file mode 100644 index 0000000..a239968 --- /dev/null +++ b/.pr-preview.json @@ -0,0 +1,4 @@ +{ + "src_file": "index.html", + "type": "respec" +}