diff --git a/dom.bs b/dom.bs index 20de2363..32c0b71c 100644 --- a/dom.bs +++ b/dom.bs @@ -9901,20 +9901,21 @@ and {{Range/getBoundingClientRect()}} methods are defined in other specification
{{NodeIterator}} and {{TreeWalker}} objects can be used to filter and traverse node trees. -
Each {{NodeIterator}} and {{TreeWalker}} object has an associated -active flag to avoid recursive -invocations. It is initially unset. +
Each {{NodeIterator}} and {{TreeWalker}} object has an associated boolean +is active to avoid recursive invocations. It is +initially false.
Each {{NodeIterator}} and {{TreeWalker}} object also has an associated -root (a node), a -whatToShow (a bitmask), and a -filter (a callback). +root (a node), a +whatToShow (a bitmask), and a +filter (a callback). +
To filter a node node within -a {{NodeIterator}} or {{TreeWalker}} object traverser, run these steps: +a {{NodeIterator}} or {{TreeWalker}} object traverser:
If traverser's active flag is set, then throw an +
If traverser's is active is true, then throw an "{{InvalidStateError!!exception}}" {{DOMException}}.
Let n be node's {{Node/nodeType}} attribute value − 1. @@ -9927,17 +9928,18 @@ a {{NodeIterator}} or {{TreeWalker}} object traverser, run these step
If traverser's filter is null, then return {{NodeFilter/FILTER_ACCEPT}}. -
Set traverser's active flag. +
Set traverser's is active to true.
Let result be the return value of call a user object's operation with
traverser's filter, "acceptNode", and
- « node ». If this throws an exception, then unset traverser's
- active flag and rethrow the exception.
+ « node ». If this throws an exception, then set traverser's
+ is active to false and rethrow the exception.
-
Unset traverser's active flag. +
Set traverser's is active to false.
Return result.
As mentioned earlier, {{NodeIterator}} objects have an associated -active flag, root, whatToShow, and +is active, root, whatToShow, and filter as well. +
The NodeIterator pre-remove steps
-given a nodeIterator and toBeRemovedNode, are as follows:
+given a {{NodeIterator}} object nodeIterator and node
+toBeRemovedNode, are:
If toBeRemovedNode is not an inclusive ancestor of @@ -9988,44 +9992,52 @@ given a nodeIterator and toBeRemovedNode, are as follows:
Let next be toBeRemovedNode's first following node that is an inclusive descendant of nodeIterator's root and is not an inclusive descendant of - toBeRemovedNode, and null if there is no such node. + toBeRemovedNode, if there is such a node; otherwise null.
If next is non-null, then set nodeIterator's reference to next and return. -
Otherwise, set nodeIterator's pointer before reference to - false. - -
Steps are not terminated here. +
Set nodeIterator's pointer before reference to false.
Set nodeIterator's reference to toBeRemovedNode's parent, if toBeRemovedNode's - previous sibling is null, and to the inclusive descendant of - toBeRemovedNode's previous sibling that appears last in tree order - otherwise. + previous sibling is null; otherwise to the inclusive descendant of + toBeRemovedNode's previous sibling that appears last in tree order. +
The pointerBeforeReferenceNode getter steps
are to return this's pointer before reference.
+
The whatToShow getter steps are to return
this's whatToShow.
+
To traverse, given a
-{{NodeIterator}} object iterator and a direction direction, run these steps:
+{{NodeIterator}} object iterator and "next" or "previous"
+type:
Let node be iterator's reference. @@ -10038,27 +10050,28 @@ are to return this's pointer before reference.
Branch on direction: +
If type is next":
-
If beforeNode is false, then set node to the first node - following node in iterator's - iterator collection. If there is no such node, then - return null. +
If beforeNode is false, then set node to the first + node following node in iterator's + iterator collection. If there is no such node, then return + null. -
If beforeNode is true, then set it to false. +
If beforeNode is true, then set it to false. +
If beforeNode is true, then set node to the first node - preceding node in iterator's - iterator collection. If there is no such node, then - return null. +
Otherwise: -
If beforeNode is false, then set it to true. -
If beforeNode is true, then set node to the first + node preceding node in iterator's + iterator collection. If there is no such node, then return + null. + +
If beforeNode is false, then set it to true. +
Let result be the result of filtering node within iterator. @@ -10073,16 +10086,23 @@ are to return this's pointer before reference.
Return node.
The nextNode() method steps are to return the
-result of traversing with this and next.
+result of traversing with this and "next".
+
The previousNode() method steps are to return the
-result of traversing with this and previous.
+result of traversing with this and "previous".
+
The detach() method steps are to do nothing.
Its functionality (disabling a {{NodeIterator}} object) was removed, but the method
itself is preserved for compatibility.
+
As mentioned earlier {{TreeWalker}} objects have an associated root, whatToShow, and filter as well. +
+The whatToShow getter steps are to return
this's whatToShow.
+
The parentNode() method steps are:
Return null.
To traverse children, given a
-walker and type, run these steps:
+{{TreeWalker}} object walker and "first" or "last"
+type:
Let node be walker's current.
Set node to node's first child if type is
- first, and node's last child if type is last.
+ "first"; otherwise to node's last child.
While node is non-null: @@ -10174,7 +10208,7 @@ method on {{Document}} objects.
Let child be node's first child if type
- is first, and node's last child if type is last.
+ is "first"; otherwise node's last child.
If child is non-null, then set node to child and continue. @@ -10185,8 +10219,8 @@ method on {{Document}} objects.
Let sibling be node's next sibling if
- type is first, and node's previous sibling if
- type is last.
+ type is "first"; otherwise node's
+ previous sibling.
If sibling is non-null, then set node to sibling and break. @@ -10202,15 +10236,21 @@ method on {{Document}} objects.
Return null.
The firstChild() method steps are to
-traverse children with this and first.
+traverse children with this and "first".
+
The lastChild() method steps are to
-traverse children with this and last.
+traverse children with this and "last".
+
To traverse siblings, given a walker -and type, run these steps: +
To traverse siblings, given a {{TreeWalker}}
+object walker and "next" or "previous" type:
Let node be walker's current. @@ -10222,8 +10262,8 @@ and type, run these steps:
Let sibling be node's next sibling if
- type is next, and node's previous sibling if
- type is previous.
+ type is "next"; otherwise node's
+ previous sibling.
While sibling is non-null: @@ -10238,12 +10278,12 @@ and type, run these steps: current to node and return node.
Set sibling to node's first child if
- type is next, and node's last child if type is
- previous.
+ type is "next"; otherwise to node's
+ last child.
If result is {{NodeFilter/FILTER_REJECT}} or sibling is null, then
set sibling to node's next sibling if type is
- next, and node's previous sibling if type is previous.
+ "next"; otherwise to node's previous sibling.
Set node to node's parent. @@ -10255,13 +10295,19 @@ and type, run these steps: {{NodeFilter/FILTER_ACCEPT}}, then return null.
The nextSibling() method steps are to
-traverse siblings with this and next.
+traverse siblings with this and "next".
+
The previousSibling() method steps are to
-traverse siblings with this and previous.
+traverse siblings with this and "previous".
+
The previousNode() method steps are:
Return null.
The nextNode() method steps are: