The ordered set parser takes a string
input and then runs these steps:
@@ -150,46 +151,55 @@ first following sibling or null if it has no
The ordered set serializer takes a set and returns the concatenation of set using U+0020 SPACE. +
To scope-match a selectors string selectors against a -node, run these steps: +
To scope-match a selectors string given a string selectors against a +node node:
Let s be the result of parse a selector selectors. +
Let selector be the result of parse a selector selectors. [[!SELECTORS4]] -
If s is failure, then throw a "{{SyntaxError!!exception}}" +
If selector is failure, then throw a "{{SyntaxError!!exception}}" {{DOMException}}. -
Return the result of match a selector against a tree with s and +
Return the result of match a selector against a tree with selector and node's root using scoping root node. [[!SELECTORS4]].
Support for namespaces within selectors is not planned and will not be -added. +
Support for namespaces within selectors is not planned and will not be added.
A [=string=] is a valid namespace prefix if its [=string/length=] is at least 1 and it does not contain [=ASCII whitespace=], U+0000 NULL, U+002F (/), or U+003E (>). +
A [=string=] is a valid attribute local name if its [=string/length=] is at least 1 and it does not contain [=ASCII whitespace=], U+0000 NULL, U+002F (/), U+003D (=), or U+003E (>). +
A [=string=] |name| is a valid element local name if the following steps return true:
If |name|'s [=string/length=] is 0, then return false.
If |name|'s 0th [=code point=] is an [=ASCII alpha=], then: +
If |name|'s 0th [=code point=] is an [=ASCII alpha=]:
If |name| contains [=ASCII whitespace=], U+0000 NULL, U+002F (/), or U+003E (>), then @@ -207,6 +217,7 @@ and it does not contain [=ASCII whitespace=], U+0000 NULL, U+002F (/), U+003D (=
Return true.
This concept is used to validate [=/element=] [=Element/local names=], when constructed by DOM APIs. The intention is to allow any name that is possible to construct using the @@ -228,6 +239,7 @@ U+0000 NULL, or U+003E (>).
The empty string is a [=valid doctype name=]. +
To validate and extract a namespace and qualifiedName, given a context: @@ -277,6 +289,7 @@ U+0000 NULL, or U+003E (>).
Return (namespace, prefix, localName). +
Various APIs in this specification used to validate namespace prefixes, attribute local names, @@ -1196,7 +1209,7 @@ participate in a tree structure.
service worker events, then report a warning to the console that this might not give the expected results. [[!SERVICE-WORKERS]] -If listener's signal is not null and is +
If listener's signal is non-null and is [=AbortSignal/aborted=], then return.
If listener's callback is null, then return. @@ -1213,7 +1226,7 @@ participate in a tree structure.
listener to eventTarget's event listener list.If listener's signal is not null, then +
If listener's signal is non-null, then add the following abort steps to it:
Let callbacks be « ».
For each listener of global's - event listener list: - -
If listener's type is "fetch", and
- listener's callback is not null, then
- append listener's callback to
- callbacks.
-
fetch" and listener's callback is non-null,
+ then append listener's callback to
+ callbacks.
Return callbacks.
The object's supported property indices are the numbers in the range zero to one less than the number of nodes represented by the collection. If there are no such elements, then there are no supported property indices. @@ -3794,8 +3801,6 @@ elements, then there are no supported property indices. indexth node in the collection, then the method must return null. -
Set an existing attribute value with this and the given value.
Replace data with node this, offset 0, count this's - length, and data the given value. +
Replace data of this with 0, this's length, and + the given value.
Do nothing. @@ -4735,8 +4740,8 @@ do as defined below, switching on the interface node implements
Set an existing attribute value with node and value.
Replace data with node node, offset 0, count node's - length, and data value. +
Replace data of node with 0, node's length, and + value.
Do nothing. @@ -4754,24 +4759,24 @@ empty string instead, and then run set text content with this and into the first of their nodes. +
The normalize() method steps are to run these steps for
each descendant exclusive Text node node of
this:
Let length be node's length. -
If length is zero, then remove node and continue with the
next exclusive Text node, if any.
-
Text nodes (excluding itself), in
- tree order.
+ Let data be the concatenation of the
+ data of node's
+ contiguous exclusive Text nodes (excluding itself), in tree order.
-
Replace data of node with length, 0, and data. -
Let currentNode be node's next sibling.
While currentNode is an exclusive Set currentNode to its next sibling.
Text node:
@@ -4800,25 +4805,24 @@ each descendant exclusive Text node nod
Text nodes
+ Remove node's contiguous exclusive Text nodes
(excluding itself), in tree order.
+
node . cloneNode([subtree = false])
+ node . cloneNode([subtree = false])
node . {{Node/isEqualNode(otherNode)}}
+ node . isEqualNode(otherNode)
A node A equals a
node B if all of the following conditions are true:
@@ -5039,14 +5044,17 @@ and an optional document docume
Each child of A equals the child
of B at the identical index.
+
The isEqualNode(otherNode) method steps are to
return true if otherNode is non-null and this equals
otherNode; otherwise false.
+
The isSameNode(otherNode) method steps are to
return true if otherNode is this; otherwise false.
-
If element's parent element is not null, then return the result of running +
If element's parent element is non-null, then return the result of running locate a namespace prefix on that element using namespace.
Return null.
@@ -5755,7 +5763,7 @@ method steps are to return the list of elements with class names classNa
Returns a copy of node. If options is true or options is a
dictionary whose {{ImportNodeOptions/selfOnly}} is false, the copy also includes the
@@ -5958,13 +5966,11 @@ method steps are:
If node is a document or a shadow root, throws a
"{{NotSupportedError!!exception}}" {{DOMException}}.
- Moves node from another document and returns it.
- If node is a document, throws a "{{NotSupportedError!!exception}}"
+ If node is a document, throws a "{{NotSupportedError!!exception}}"
{{DOMException}} or, if node is a shadow root, throws a
"{{HierarchyRequestError!!exception}}" {{DOMException}}.
The
If result has children, then throw a
"{{NotSupportedError!!exception}}" {{DOMException}}.
- If result's parent is non-null, then throw a
"{{NotSupportedError!!exception}}" {{DOMException}}.
If result's node document is not document, then
@@ -7676,7 +7678,7 @@ a boolean serializable, a boolean delegatesFocus, a string
namespace, its local name, and its
If definition is not null and definition's
+ If definition is non-null and definition's
disable shadow is true, then throw a
"{{NotSupportedError!!exception}}" {{DOMException}}.
@@ -7775,40 +7777,44 @@ return this's custom element registry.
yields element; otherwise false.
+ The Let s be the result of parse a selector from selectors.
+ Let selector be the result of parse a selector from selectors.
[[!SELECTORS4]]
- If s is failure, then throw a "{{SyntaxError!!exception}}"
+ If selector is failure, then throw a "{{SyntaxError!!exception}}"
{{DOMException}}.
Let elements be this's inclusive ancestors that are
elements, in reverse tree order.
For each element of elements: if
- match a selector against an element, using s, element, and
+ match a selector against an element, using selector, element, and
scoping root this, returns success, return element. [[!SELECTORS4]]
Return null.
The Let s be the result of parse a selector from selectors.
+ Let selector be the result of parse a selector from selectors.
[[!SELECTORS4]]
- If s is failure, then throw a "{{SyntaxError!!exception}}"
+ If selector is failure, then throw a "{{SyntaxError!!exception}}"
{{DOMException}}.
- If the result of match a selector against an element, using s,
+ If the result of match a selector against an element, using selector,
this, and scoping root this, returns success, then return true; otherwise,
return false. [[!SELECTORS4]]
A {{NamedNodeMap}} object's supported property indices are the numbers in the
-range zero to its attribute list's size minus one, unless
+range zero to its attribute list's size − 1, unless
the attribute list is empty, in which case there are no
supported property indices.
@@ -8120,56 +8126,54 @@ is used by {{Text}}, {{ProcessingInstruction}}, and {{Comment}} nodes
Each node inheriting from the {{CharacterData}} interface has an associated mutable
string called data.
- To replace data of node node with offset
-offset, count count, and data data, run these steps:
+ To replace data of a node node
+with an integer offset, integer count, and string data:
Let length be node's length.
- If offset is greater than length, then throw an
"{{IndexSizeError!!exception}}" {{DOMException}}.
- If offset + count is greater than length, then set
+ count to length − offset.
Queue a mutation record of " Insert data into node's data after
+ offset code units.
- Let deleteOffset be offset + data's
+ length.
- Starting from deleteOffset code units, remove count
+ code units from node's data.
For each live range whose start node is node and
start offset is greater than offset but less than or equal to
- offset plus count, set its start offset to
- offset.
+ offset + count: set its start offset to offset.
For each live range whose end node is node and
end offset is greater than offset but less than or equal to
- offset plus count, set its end offset to offset.
+ offset + count: set its end offset to offset.
For each live range whose start node is node and
- start offset is greater than offset plus count, increase its
+ start offset is greater than offset + count: increase its
start offset by data's length and decrease it by
count.
For each live range whose end node is node and
- end offset is greater than offset plus count, increase its
+ end offset is greater than offset + count: increase its
end offset by data's length and decrease it by
count.
If node's parent is non-null, then run the
children changed steps for node's parent.
To
+substring data
+of a node node with an integer offset and integer
+count:
Let length be node's length.
- If offset is greater than length, then throw an
"{{IndexSizeError!!exception}}" {{DOMException}}.
- If offset + count is greater than length, then return a
+ string whose value is the code units from the offsetth
+ code unit to the end of node's data.
- Return a string whose value is the code units from the offsetth
+ code unit to the offset+countth code unit in
+ node's data.
The The
The The
The
The
The contiguous {{Text}} nodes of a node node are
node, node's previous sibling {{Text}} node, if any, and
its contiguous The contiguous exclusive {{Text}} nodes of a node node
are node, node's previous sibling
exclusive The child text content of a node
node is the concatenation of the data of all
the {{Text}} node children of node, in tree order.
+ The descendant text content of a
node node is the concatenation of the
data of all the {{Text}} node descendants of
node, in tree order.
+ The To split a {{Text}}
-node node with offset offset, run these steps:
+node node with integer offset:
Let length be node's length.
- If offset is greater than length, then throw an
"{{IndexSizeError!!exception}}" {{DOMException}}.
- Let count be length − offset.
- Let newData be the result of substringing data of node with
+ offset and count.
- Let newNode be a new {{Text}} node whose
+ node document is node's node document and
+ data is newData.
- Let parent be node's parent.
If parent is not null:
+ If parent is non-null:
Insert new node into parent before node's
+ Insert newNode into parent before node's
next sibling.
@@ -8374,19 +8393,23 @@ constructor steps are to set this's data to end offset by 1.
Replace data of node with offset, count, and
+ the empty string.
- Return newNode.
The {{ProcessingInstruction}} nodes have an associated
target.
+ The The position of a
boundary point (nodeA, offsetA) relative to a boundary point
(nodeB, offsetB) is
@@ -8547,6 +8575,7 @@ be between 0 and the boundary point's node's
Return before.
+ A range is collapsed if its start node is its
end node and its start offset is its end offset.
+ The
The The Returns a new range object that does not update when the node tree mutates.
+ The
A {{StaticRange}} is valid if all of the following are true:
xml" and namespace is not the
XML namespace.
@@ -5946,7 +5954,7 @@ method steps are:
-
@@ -6309,8 +6315,6 @@ interface DOMImplementation {
argument is omitted.
-clone = document . importNode(node [, options = false])
node = document . adoptNode(node)
createDocumentType(name, publicId, systemId)
method steps are:
@@ -6411,8 +6415,6 @@ reliable or granular as simply checking whether the desired objects, attributes,
methods existed. As such, it is no longer to be used, but continues to exist (and simply
returns true) so that old pages don't stop working.
-Interface {{DocumentType}}
@@ -6907,7 +6909,7 @@ null, or a {{CustomElementRegistry}} object registry (default "
is value.
- closest(selectors) method steps are:
-
+matches(selectors) and
webkitMatchesSelector(selectors) method steps
are:
-
+
@@ -7907,7 +7913,7 @@ interface NamedNodeMap {
-
+characterData" for node with
null, null, node's data, « », « », null, and null.
-
-
+data getter steps are to return
-this's data. Its setter must replace data with node
-this, offset 0, count this's length, and data new value.
+this's data. Its setter steps are to replace data of
+this with 0, this's length, and the given value.
+substringData(offset, count)
-method steps are to return the result of running substring data with node this,
-offset offset, and count count.
+method steps are to return the result of substringing data of this with
+offset and count.
+appendData(data) method steps are
-to replace data with node this, offset this's length, count 0,
-and data data.
+to replace data of this with this's length, 0, and
+data.
+insertData(offset, data)
-method steps are to replace data with node this, offset offset, count 0,
-and data data.
+method steps are to replace data of this with offset, 0, and
+data.
+deleteData(offset, count)
-method steps are to replace data with node this, offset offset, count
-count, and data the empty string.
+method steps are to replace data of this with offset, count, and
+the empty string.
+replaceData(offset, count, data)
-method steps are to replace data with node this, offset offset, count
-count, and data data.
+method steps are to replace data of this with offset, count, and
+data.
+Interface {{Text}}
@@ -8286,69 +8298,76 @@ interface Text : CharacterData {
+
+Text nodes, and node's next sibling
{{Text}} node, if any, and its contiguous Text nodes, avoiding any
duplicates.
+Text node, if any, and its
contiguous exclusive Text nodes, and node's
next sibling exclusive Text node, if any, and its
contiguous exclusive Text nodes, avoiding any duplicates.
+
+new Text(data)
constructor steps are to set this's data to data and
this's node document to current global object's
associated Document.
+
-
+
-
- wholeText getter steps are to return the
concatenation of the data of the
contiguous Text nodes of this, in tree order.
+Interface {{CDATASection}}
@@ -8408,8 +8431,10 @@ interface ProcessingInstruction : CharacterData {
Interface {{Comment}}
@@ -8427,10 +8452,12 @@ interface Comment : CharacterData {
data is data.
+new Comment(data)
constructor steps are to set this's data to data and
this's node document to current global object's
associated Document.
+Interface {{AbstractRange}}
@@ -8579,8 +8608,10 @@ interface AbstractRange {
end offset is its end's
offset.
+
+node = range . startContainer
@@ -8599,21 +8630,31 @@ interface AbstractRange {
startContainer
getter steps are to return this's start node.
+startOffset
getter steps are to return this's start offset.
+endOffset
getter steps are to return this's end offset.
+Interface {{StaticRange}}
@@ -8637,6 +8678,7 @@ interface StaticRange : AbstractRange {
new StaticRange(init)
constructor steps are:
@@ -8652,7 +8694,9 @@ constructor steps are:
(init["{{StaticRangeInit/endContainer}}"],
init["{{StaticRangeInit/endOffset}}"]).
+Interface {{Range}}
@@ -8783,13 +8828,13 @@ but not its end node, or vice versa.
The live range pre-remove steps given a node node, are as -follows: +
The live range pre-remove steps given a node node, are:
Let parent be node's parent. -
Assert: parent is not null. +
Assert: parent is non-null.
Let index be node's index. @@ -8808,6 +8853,7 @@ follows: end offset is greater than index, decrease its end offset by 1.
The new Range() constructor steps are
to set this's start and end to
(current global object's associated Document, 0).
+
The commonAncestorContainer getter steps are:
Let container be start node. -
While container is not an inclusive ancestor of + end node: set container to container's parent. -
Return container.
To set the start or end -of a range to a boundary point (node, offset), run these -steps: +of a range to a boundary point (node, offset):
If node is a doctype, then throw an "{{InvalidNodeTypeError!!exception}}" {{DOMException}}. -
If offset is greater than node's length, then throw an "{{IndexSizeError!!exception}}" {{DOMException}}. -
Let boundaryPoint be the boundary point (node, offset).
If range's root is not node's + root or boundaryPoint is after + range's end, then set range's end + to boundaryPoint. + +
Set range's start to boundaryPoint.
If range's root is not node's + root or boundaryPoint is before + range's start, then set range's start + to boundaryPoint. + +
Set range's end to boundaryPoint.
The setStart(node, offset) method
steps are to set the start of this to boundary point
(node, offset).
+
The setEnd(node, offset) method
steps are to set the end of this to boundary point
(node, offset).
+
The setStartBefore(node) method steps are:
Let parent be node's parent. -
If parent is null, then throw an "{{InvalidNodeTypeError!!exception}}" {{DOMException}}. -
Set the start of this to boundary point + (parent, node's index).
The setStartAfter(node) method steps are:
Set the start of this to boundary point (parent, node's index plus 1).
The setEndBefore(node) method steps are:
Let parent be node's parent. -
If parent is null, then throw an "{{InvalidNodeTypeError!!exception}}" {{DOMException}}. -
Set the end of this to boundary point (parent, node's index).
The setEndAfter(node) method steps are:
Set the end of this to boundary point (parent, node's index plus 1).
The collapse(toStart) method steps are to, if
toStart is true, set end to start; otherwise set
start to end.
+
To select a node node -within a range range, run these steps: +within a range range:
Let parent be node's parent. @@ -8981,15 +9026,19 @@ within a range range, run these steps:
Set range's end to boundary point (parent, index plus 1).
The selectNodeContents(node) method steps
are:
The
compareBoundaryPoints(how, sourceRange)
method steps are:
@@ -9038,57 +9089,51 @@ method steps are:
Opera) instead of a nonstandard exception type.
-->
-
If this's root is not sourceRange's + root, then throw a "{{WrongDocumentError!!exception}}" + {{DOMException}}. + +
Let thisPoint and sourcePoint be null.
Switch on how: +
Set thisPoint to this's start and + sourcePoint to sourceRange's start.
Set thisPoint to this's end and sourcePoint + to sourceRange's start. -
If the position of this point relative to - other point is +
Set thisPoint to this's end and sourcePoint + to sourceRange's end. + +
Set thisPoint to this's start and + sourcePoint to sourceRange's end. + -
+The deleteContents() method steps are:
Let originalStartNode, originalStartOffset, + originalEndNode, and originalEndOffset be this's + start node, start offset, end node, and end offset, respectively. -
If original start node is original end node and it is a - {{CharacterData}} node, then - replace data with node - original start node, offset - original start offset, count - original end offset minus - original start offset, and data the empty string, and then return. - -
If originalStartNode is originalEndNode and it is a {{CharacterData}} + node: + +
Replace data of originalStartNode with originalStartOffset, + originalEndOffset − originalStartOffset, and the empty string. + +
Return. +
Let nodesToRemove be a list of all the nodes that are + contained in this, in tree order, omitting any + node whose parent is also contained in + this. + +
Let newNode and newOffset be null. + +
If originalStartNode is an inclusive ancestor of + originalEndNode, then set newNode to originalStartNode and + newOffset to originalStartOffset.
Otherwise: +
Let referenceNode be originalStartNode. -
While referenceNode's parent is non-null and is not an + inclusive ancestor of originalEndNode: set referenceNode to + its parent.
If reference node's - parent were null, it would be the - root of - this, so would be an - inclusive ancestor of - original end node, and we could not reach this point. +
Set newNode to referenceNode's parent and + newOffset to referenceNode's index + 1. + +
If referenceNode's parent were null, it would be the + root of this. And then it would be an + inclusive ancestor of originalEndNode and we could not reach this + point.
If original start node is a {{CharacterData}} node, then - replace data with node original start node, offset - original start offset, count original start node's length - − original start offset, data the empty string. +
If originalStartNode is a {{CharacterData}} node, then + replace data of originalStartNode with originalStartOffset, + originalStartNode's length − originalStartOffset, and + the empty string. -
For each node of nodes to remove, in tree order: +
For each node of nodesToRemove, in tree order: remove node. -
If original end node is a {{CharacterData}} node, then - replace data with node - original end node, offset 0, count - original end offset and data the empty string. +
If originalEndNode is a {{CharacterData}} node, then + replace data of originalEndNode with 0, originalEndOffset, and + the empty string. -
To extract a live range -range, run these steps: +range:
Let fragment be a new {{DocumentFragment}} node whose @@ -9189,88 +9224,65 @@ method steps are: Otherwise, the following steps are all no-ops. But it's simplest to include this step anyway. --> -
Let originalStartNode, originalStartOffset, + originalEndNode, and originalEndOffset be range's + start node, start offset, end node, and end offset, respectively.
If original start node is original end node and it is a {{CharacterData}} +
If originalStartNode is originalEndNode and it is a {{CharacterData}} node:
Let clone be a clone of originalStartNode. + +
Set clone's data to the result of + substringing data of originalStartNode with originalStartOffset and + originalEndOffset − originalStartOffset. + +
Append clone to fragment. + +
Replace data of originalStartNode with originalStartOffset, + originalEndOffset − originalStartOffset, and the empty string.
Let commonAncestor be originalStartNode. -
While commonAncestor is not an inclusive ancestor of + originalEndNode: set commonAncestor to its own parent. -
Let firstPartiallyContainedChild be null. -
Let lastPartiallyContainedChild be null.
If originalEndNode is not an inclusive ancestor of + originalStartNode, then set lastPartiallyContainedChild to the last + child of commonAncestor that is partially contained in range. -
These variable assignments do actually always make sense. - For instance, if original start node is not an - inclusive ancestor of - original end node, original start node is itself +
These variable assignments do actually always make sense. For instance, if + originalStartNode is not an inclusive ancestor of + originalEndNode, originalStartNode is itself partially contained in range, and so are all its - ancestors up until a - child of common ancestor. - common ancestor cannot be original start node, because - it has to be an inclusive ancestor of - original end node. The other case is similar. Also, notice that the two - children will never be equal if both are defined. - -
Let containedChildren be a list of all children of + commonAncestor that are contained in range, in + tree order.
If any member of contained children is a doctype, then throw a +
If any member of containedChildren is a doctype, then throw a "{{HierarchyRequestError!!exception}}" {{DOMException}}.
If first partially contained child is a {{CharacterData}} node: +
If firstPartiallyContainedChild is a {{CharacterData}} node: -
In this case, first partially contained child is - original start node. +
In this case, firstPartiallyContainedChild is + originalStartNode.
Let clone be a clone of - original start node. + originalStartNode.
Set the data of clone to the result of - substringing data with node original start node, offset - original start offset, and count original start node's - length − original start offset. + substringing data of originalStartNode with originalStartOffset and + originalStartNode's length − originalStartOffset.
Append clone to fragment. -
Replace data with node original start node, offset - original start offset, count original start node's length - − original start offset, and data the empty string. +
Replace data of originalStartNode with originalStartOffset, + originalStartNode's length − originalStartOffset, and + the empty string.
Otherwise, if firstPartiallyContainedChild is non-null:
Let clone be a clone of + firstPartiallyContainedChild. + +
Append clone to fragment. + +
Let subrange be a new live range whose start is + (originalStartNode, originalStartOffset) and whose end is + (firstPartiallyContainedChild, firstPartiallyContainedChild's length).
Let subfragment be the result of extracting subrange. -
For each contained child of contained children: append +
For each contained child of containedChildren: append contained child to fragment.
If last partially contained child is a {{CharacterData}} node: +
If lastPartiallyContainedChild is a {{CharacterData}} node: -
In this case, last partially contained child is - original end node. +
In this case, lastPartiallyContainedChild is + originalEndNode.
Let clone be a clone of originalEndNode. -
Set clone's data to the result of + substringing data of originalEndNode with 0 and originalEndOffset. -
Append clone to fragment. -
Replace data of originalEndNode with 0, originalEndOffset, + and the empty string.
Otherwise, if lastPartiallyContainedChild is non-null:
Let clone be a clone of + lastPartiallyContainedChild. -
Append clone to fragment. -
Let subrange be a new live range whose start is + (lastPartiallyContainedChild, 0) and whose end is + (originalEndNode, originalEndOffset).
Let subfragment be the result of extracting subrange. -
Append subfragment to clone.
Return fragment.
The extractContents() method steps are to return the
result of extracting this.
+
To clone the contents -of a live range range, run these steps: +of a live range range:
Let fragment be a new {{DocumentFragment}} node whose @@ -9443,82 +9435,62 @@ of a live range range, run these steps: Otherwise, the following steps are all no-ops. But it's simplest to include this step anyway. --> -
Let originalStartNode, originalStartOffset, + originalEndNode, and originalEndOffset be range's + start node, start offset, end node, and end offset, respectively.
If original start node is original end node and it is a {{CharacterData}} +
If originalStartNode is originalEndNode and it is a {{CharacterData}} node:
Let clone be a clone of originalStartNode. -
Set clone's data to the result of + substringing data of originalStartNode with originalStartOffset and + originalEndOffset − originalStartOffset. -
Append clone to fragment. -
Return fragment.
Let commonAncestor be originalStartNode. -
While commonAncestor is not an inclusive ancestor of + originalEndNode: set commonAncestor to its own parent. -
Let firstPartiallyContainedChild be null. -
If originalStartNode is not an inclusive ancestor of + originalEndNode, then set firstPartiallyContainedChild to the first + child of commonAncestor that is + partially contained in range. -
Let lastPartiallyContainedChild be null.
If originalEndNode is not an inclusive ancestor of + originalStartNode, then set lastPartiallyContainedChild to the last + child of commonAncestor that is partially contained in range. -
These variable assignments do actually always make sense. - For instance, if original start node is not an - inclusive ancestor of - original end node, original start node is itself +
These variable assignments do actually always make sense. For instance, if + originalStartNode is not an inclusive ancestor of + originalEndNode, originalStartNode is itself partially contained in range, and so are all its - ancestors up until a - child of common ancestor. - common ancestor cannot be original start node, because - it has to be an inclusive ancestor of - original end node. The other case is similar. Also, notice that the two - children will never be equal if both are defined. - -
Let containedChildren be a list of all children of + commonAncestor that are contained in range, in + tree order.
If any member of contained children is a doctype, then throw a +
If any member of containedChildren is a doctype, then throw a "{{HierarchyRequestError!!exception}}" {{DOMException}}.
We do not have to worry about the first or last partially @@ -9527,51 +9499,43 @@ of a live range range, run these steps: cannot be the ancestor of anything.
If first partially contained child is a {{CharacterData}} node: +
If firstPartiallyContainedChild is a {{CharacterData}} node: -
In this case, first partially contained child is - original start node. +
In this case, firstPartiallyContainedChild is + originalStartNode.
Let clone be a clone of - original start node. +
Let clone be a clone of originalStartNode.
Set the data of clone to the result of - substringing data with node original start node, offset - original start offset, and count original start node's - length − original start offset. + substringing data of originalStartNode with originalStartOffset and + originalStartNode's length − originalStartOffset.
Append clone to fragment.
Otherwise, if firstPartiallyContainedChild is non-null:
Let clone be a clone of + firstPartiallyContainedChild. + +
Append clone to fragment. + +
Let subrange be a new live range whose start is + (originalStartNode, originalStartOffset) and whose end is + (firstPartiallyContainedChild, firstPartiallyContainedChild's length).
Let subfragment be the result of cloning the contents of subrange. -
Append subfragment to clone.
For each contained child of contained children: +
For each contained child of containedChildren:
Let clone be a clone of contained child @@ -9581,63 +9545,57 @@ of a live range range, run these steps:
If last partially contained child is a {{CharacterData}} node: +
If lastPartiallyContainedChild is a {{CharacterData}} node: -
In this case, last partially contained child is - original end node. +
In this case, lastPartiallyContainedChild is + originalEndNode.
Let clone be a clone of originalEndNode. -
Set clone's data to the result of + substringing data of originalEndNode with 0 and originalEndOffset. -
Append clone to fragment.
Otherwise, if lastPartiallyContainedChild is non-null:
Let clone be a clone of + lastPartiallyContainedChild. -
Append clone to fragment. -
Let subrange be a new live range whose start is + (lastPartiallyContainedChild, 0) and whose end is + (originalEndNode, originalEndOffset).
Let subfragment be the result of cloning the contents of subrange. -
Append subfragment to clone.
Return fragment.
The cloneContents() method steps are to return the
result of cloning the contents of this.
+
To insert a node -node into a live range range, run these steps: +node into a live range range:
If range's start node is a {{ProcessingInstruction}} or + {{Comment}} node, is a {{Text}} node whose parent is + null, or is node, then throw a "{{HierarchyRequestError!!exception}}" + {{DOMException}}. -
Let referenceNode be null. + +
If range's start node is a {{Text}} node, then set + referenceNode to that {{Text}} node. + + +
Otherwise, set referenceNode to the child of range's + start node whose index is range's + start offset if there is such a child; otherwise null. + +
Let parent be range's start node if + referenceNode is null; otherwise referenceNode's parent. -
Ensure pre-insert validity of node into parent before referenceNode. -
If range's start node is a {{Text}} node, then set + referenceNode to the result of splitting it with offset + range's start offset. -
If node is referenceNode, then set referenceNode to its next sibling. @@ -9724,16 +9675,19 @@ result of cloning the contents of this.
Increase newOffset by node's length if node is a {{DocumentFragment}} node; otherwise 1. -
Pre-insert node into parent before referenceNode.
If range is collapsed, then set range's end to (parent, newOffset).
The surroundContents(newParent) method steps
are:
@@ -9780,13 +9734,18 @@ check first thing, which matches everyone but Firefox.
but it makes a difference in at least one corner case (when the original
range lies in a single text node). -->
+
The cloneRange() method steps are to return a new
live range with the same start and end as this.
+
The detach() method steps are to do nothing.
Its functionality (disabling a {{Range}} object) was removed, but the method itself
is preserved for compatibility.
+
The isPointInRange(node, offset)
method steps are:
If node is a doctype, then throw an "{{InvalidNodeTypeError!!exception}}" {{DOMException}}. -
If (node, offset) is before + start or after end, then return + false. -
Return true.
The comparePoint(node, offset)
method steps are:
If node's root is not this's root, + then throw a "{{WrongDocumentError!!exception}}" {{DOMException}}. -
If node is a doctype, then throw an "{{InvalidNodeTypeError!!exception}}" {{DOMException}}. -
Return 0.
The intersectsNode(node) method steps are:
Let parent be node's parent. -
If parent is null, then return true. -
Let offset be node's index. -
If (parent, offset) is before + end and (parent, offset + 1) is + after start, then return true. -
Return false.
The stringification behavior must run these steps:
Let s be the empty string. +
Let string be the empty string.
If this's start node is this's end node and it is a {{Text}} node, then return the substring of that {{Text}} node's @@ -9923,18 +9873,19 @@ these steps:
If this's start node is a {{Text}} node, then append the substring of that node's data from this's - start offset until the end to s. + start offset until the end to string.
Append the concatenation of the data of all {{Text}} nodes that are contained in this, in - tree order, to s. + tree order, to string.
If this's end node is a {{Text}} node, then append the substring of that node's data from its start until - this's end offset to s. + this's end offset to string. -
Return s. +
Return string.
The object's supported property indices are the numbers in the range zero to object's -token set's size minus one, unless token set is empty, +token set's size − 1, unless token set is empty, in which case there are no supported property indices.
The item(index) method steps are: