From 43163e8629f19554800d70bc345209dc2acd622b Mon Sep 17 00:00:00 2001
From: Marcos Caceres 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 @@ 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.Background
Definition
- Definition
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 @@
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 @@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.
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.
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.
The method must follow these steps:
rangeCount
is not 0
, abort these steps.removeAllRanges()
and abort these steps.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 @@
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.
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 @@
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.
Document
interfaceThe method must return the selection associated with context object if the context object has an associated browsing context, @@ -572,22 +515,28 @@
Document
interfaceWindow
interface
+ The Window
interface is defined in [[!HTML]].
+
partial interface Window { Selection? getSelection(); };
The method must invoke and return the result of getSelection on the context object's
- document
([[!HTML5]]) property.
document
([[!HTML]]) property.
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
eventWhen 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 CaceresDate: 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" +}