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:

    -
  1. If traverser's active flag is set, then throw an +

  2. If traverser's is active is true, then throw an "{{InvalidStateError!!exception}}" {{DOMException}}.

  3. Let n be node's {{Node/nodeType}} attribute value − 1. @@ -9927,17 +9928,18 @@ a {{NodeIterator}} or {{TreeWalker}} object traverser, run these step

  4. If traverser's filter is null, then return {{NodeFilter/FILTER_ACCEPT}}. -

  5. Set traverser's active flag. +

  6. Set traverser's is active to true.

  7. 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. -

  8. Unset traverser's active flag. +

  9. Set traverser's is active to false.

  10. Return result.

+

Interface {{NodeIterator}}

@@ -9970,11 +9972,13 @@ filter matches any node. node) and pointer before reference (a boolean).

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:

  1. If toBeRemovedNode is not an inclusive ancestor of @@ -9988,44 +9992,52 @@ given a nodeIterator and toBeRemovedNode, are as follows:

  2. 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.

  3. If next is non-null, then set nodeIterator's reference to next and return. -

  4. -

    Otherwise, set nodeIterator's pointer before reference to - false. - -

    Steps are not terminated here. +

  5. 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 root getter steps are to return this's root. +

    +

    The referenceNode getter steps are to return this's reference. +

    +

    The pointerBeforeReferenceNode getter steps are to return this's pointer before reference. +

    +

    The whatToShow getter steps are to return this's whatToShow. +

    +

    The filter getter steps are to return this's filter. +

    +

    To traverse, given a -{{NodeIterator}} object iterator and a direction direction, run these steps: +{{NodeIterator}} object iterator and "next" or "previous" +type:

    1. Let node be iterator's reference. @@ -10038,27 +10050,28 @@ are to return this's pointer before reference.

      1. -

        Branch on direction: +

        If type is next": -

        -
        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. +

          +
        1. 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. +

        2. If beforeNode is true, then set it to false. +

        -
        previous -
        -

        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. +

      2. +

        Otherwise: -

        If beforeNode is false, then set it to true. -

      3. +
          +
        1. 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. + +

        2. If beforeNode is false, then set it to true. +

      4. Let result be the result of filtering node within iterator. @@ -10073,16 +10086,23 @@ are to return this's pointer before reference.

      5. 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. +

    Interface {{TreeWalker}}

    @@ -10113,23 +10133,34 @@ method on {{Document}} objects.

    As mentioned earlier {{TreeWalker}} objects have an associated root, whatToShow, and filter as well. +

    The root getter steps are to return this's root. +

    +

    The whatToShow getter steps are to return this's whatToShow. +

    +

    The filter getter steps are to return this's filter. +

    +

    The currentNode getter steps are to return this's current. +

    +

    The {{TreeWalker/currentNode}} setter steps are to set this's current to the given value. +


    +

    The parentNode() method steps are:

      @@ -10149,15 +10180,18 @@ method on {{Document}} objects.
    1. Return null.

    +
    +

    To traverse children, given a -walker and type, run these steps: +{{TreeWalker}} object walker and "first" or "last" +type:

    1. Let node be walker's current.

    2. 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.

    3. While node is non-null: @@ -10174,7 +10208,7 @@ method on {{Document}} objects.

      1. 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.

      2. If child is non-null, then set node to child and continue. @@ -10185,8 +10219,8 @@ method on {{Document}} objects.

        1. 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.

        2. If sibling is non-null, then set node to sibling and break. @@ -10202,15 +10236,21 @@ method on {{Document}} objects.

        3. 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:

    1. Let node be walker's current. @@ -10222,8 +10262,8 @@ and type, run these steps:

      1. 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.

      2. While sibling is non-null: @@ -10238,12 +10278,12 @@ and type, run these steps: current to node and return node.

      3. 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.

      4. 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.

    2. 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:

      @@ -10311,7 +10357,9 @@ and type, run these steps:
    1. Return null.

    +
    +

    The nextNode() method steps are:

      @@ -10362,6 +10410,7 @@ and type, run these steps: current to node and return node.
    +

    Interface {{NodeFilter}}