From 5ec535e56111d600b8afe89d0b4f709ab844461e Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 4 Mar 2016 14:22:10 +0100 Subject: [PATCH] Fix #34: invoke insertion/removing steps for descendants --- dom.bs | 43 +++++++++++++++++-------------- dom.html | 77 +++++++++++++++++++++++++++++++------------------------- 2 files changed, 67 insertions(+), 53 deletions(-) diff --git a/dom.bs b/dom.bs index b08b6b72..06b7a651 100644 --- a/dom.bs +++ b/dom.bs @@ -1546,10 +1546,15 @@ To pre-insert a -Specifications may define -insertion steps for all or some -nodes. The algorithm is passed newNode as -indicated in the insert algorithm below. +

Specifications may define +insertion steps for all or some nodes. +The algorithm is passed insertedNode and newAncestor as indicated in the +insert algorithm below. + + +

newAncestor can be insertedNode's parent. To insert a node into a parent before a child, with an optional @@ -1602,16 +1607,15 @@ into a parent before a child, with an optional suppress observers flag.

  • - For each newNode in nodes, in - tree order, run these substeps: +

    For each node in nodes, in tree order, run these substeps:

      -
    1. Insert newNode into parent before - child or at the end of parent if - child is null. +
    2. Insert node into parent before child or at the end of + parent if child is null. -

    3. Run the insertion steps with - newNode. +
    4. For each inclusive descendant inclusiveDescendant of node, in + tree order, run the insertion steps with inclusiveDescendant and + parent.

  • If suppress observers flag is unset, @@ -1805,12 +1809,13 @@ To pre-remove a -Specifications may define -removing steps for all or some -nodes. The algorithm is passed removedNode, -oldParent, and oldPreviousSibling, as indicated in the +

    Specifications may define +removing steps for all or some nodes. +The algorithm is passed removedNode and oldAncestor, as indicated in the remove algorithm below. +

    oldAncestor can be removedNode's former parent. + To remove a node from a parent, with an optional suppress observers flag, run these steps: @@ -1858,11 +1863,11 @@ steps:

  • Remove node from its parent. -
  • Run the removing steps with - node, parent, and oldPreviousSibling. +
  • For each inclusive descendant inclusiveDescendant of node, run + the removing steps with inclusiveDescendant and parent. -

  • For each inclusive ancestor ancestor of - parent, if ancestor has any registered observers +
  • For each inclusive ancestor inclusiveAncestor of + parent, if inclusiveAncestor has any registered observers whose options' {{MutationObserverInit/subtree}} is true, then for each such registered observer registered, append a transient registered observer whose observer and options diff --git a/dom.html b/dom.html index 690d115d..1f9adc6a 100644 --- a/dom.html +++ b/dom.html @@ -69,7 +69,7 @@

    DOM

    -

    Living Standard — Last Updated

    +

    Living Standard — Last Updated

    Participate: @@ -466,7 +466,7 @@

    span element, eventPhase attribute’s value would have been AT_TARGET.

    3.2. Interface Event

    -
    [Constructor(DOMString type, optional EventInit eventInitDict),
    +
    [Constructor(DOMString type, optional EventInit eventInitDict),
      Exposed=(Window,Worker)]
     interface Event {
       readonly attribute DOMString type;
    @@ -617,7 +617,7 @@ 

    As events have constructors initEvent() is superfluous. However, it has to be supported for legacy content.

    3.3. Interface CustomEvent

    -
    [Constructor(DOMString type, optional CustomEventInit eventInitDict),
    +
    [Constructor(DOMString type, optional CustomEventInit eventInitDict),
      Exposed=(Window,Worker)]
     interface CustomEvent : Event {
       readonly attribute any detail;
    @@ -1040,8 +1040,9 @@ 

    Insert node into parent before reference child.
  • Return node. -

    Specifications may define insertion steps for all or some nodes. The algorithm is passed newNode as -indicated in the insert algorithm below.

    +

    Specifications may define insertion steps for all or some nodes. +The algorithm is passed insertedNode and newAncestor as indicated in the insert algorithm below.

    +

    newAncestor can be insertedNode’s parent.

    To insert a node into a parent before a child, with an optional suppress observers flag, run these steps:

    1. Let count be the number of children of node if @@ -1063,10 +1064,12 @@

      node is a DocumentFragment node, queue a mutation record of "childList" for node with removedNodes nodes.

      This step intentionally does not pay attention to the suppress observers flag.

    2. - For each newNode in nodes, in tree order, run these substeps: +

      For each node in nodes, in tree order, run these substeps:

        -
      1. Insert newNode into parent before child or at the end of parent if child is null. -
      2. Run the insertion steps with newNode. +
      3. +

        Insert node into parent before child or at the end of parent if child is null.

        +
      4. +

        For each inclusive descendant inclusiveDescendant of node, in tree order, run the insertion steps with inclusiveDescendant and parent.

    3. If suppress observers flag is unset, queue a mutation record of "childList" for parent with addedNodes nodes, nextSibling child, and previousSibling child’s previous sibling or parent’s last child if child is null.
    @@ -1135,7 +1138,9 @@

    Remove child from parent.
  • Return child. -

    Specifications may define removing steps for all or some nodes. The algorithm is passed removedNode, oldParent, and oldPreviousSibling, as indicated in the remove algorithm below.

    +

    Specifications may define removing steps for all or some nodes. +The algorithm is passed removedNode and oldAncestor, as indicated in the remove algorithm below.

    +

    oldAncestor can be removedNode’s former parent.

    To remove a node from a parent, with an optional suppress observers flag, run these steps:

      @@ -1151,8 +1156,10 @@

      Let oldPreviousSibling be node’s previous sibling.
    1. Let oldNextSibling be node’s next sibling.
    2. Remove node from its parent. -
    3. Run the removing steps with node, parent, and oldPreviousSibling. -
    4. For each inclusive ancestor ancestor of parent, if ancestor has any registered observers whose options' subtree is true, then for each +
    5. +

      For each inclusive descendant inclusiveDescendant of node, run + the removing steps with inclusiveDescendant and parent.

      +
    6. For each inclusive ancestor inclusiveAncestor of parent, if inclusiveAncestor has any registered observers whose options' subtree is true, then for each such registered observer registered, append a transient registered observer whose observer and options are identical to those of registered and source which is registered to node’s list of registered observers.
    7. If suppress observers flag is unset, queue a mutation record of "childList" for parent with removedNodes a list solely containing node, nextSibling oldNextSibling, and previousSibling oldPreviousSibling. @@ -4766,6 +4773,7 @@

      currentTarget, in §3.2
    8. CustomEvent, in §3.3
    9. CustomEventInit, in §3.3 +
    10. CustomEvent(type), in §3.3
    11. CustomEvent(type, eventInitDict), in §3.3
    12. data @@ -4865,6 +4873,7 @@

      EventListenerOptions, in §3.6
    13. eventPhase, in §3.2
    14. EventTarget, in §3.6 +
    15. Event(type), in §3.2
    16. Event(type, eventInitDict), in §3.2
    17. expandEntityReferences, in §8.4
    18. extract, in §5.2 @@ -5435,46 +5444,46 @@

      References

      Normative References

      -
      [HTML] +
      [HTML]
      Ian Hickson. HTML Standard. Living Standard. URL: https://html.spec.whatwg.org/multipage/ -
      [WHATWG-ENCODING] -
      Anne van Kesteren. Encoding Standard. Living Standard. URL: https://encoding.spec.whatwg.org/ -
      [WHATWG-URL] -
      Anne van Kesteren; Sam Ruby. URL Standard. Living Standard. URL: https://url.spec.whatwg.org/ -
      [WebIDL] -
      Cameron McCormack; Boris Zbarsky. WebIDL Level 1. 4 August 2015. WD. URL: https://heycam.github.io/webidl/ -
      [RFC2119] +
      [RFC2119]
      S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119 -
      [SELECTORS-4] +
      [SELECTORS-4]
      Selectors Level 4 URL: https://drafts.csswg.org/selectors-4/ -
      [SELECTORS4] +
      [SELECTORS4]
      Elika Etemad; Tab Atkins Jr.. Selectors Level 4. 2 May 2013. WD. URL: http://www.w3.org/TR/selectors4/ -
      [SERVICE-WORKERS] +
      [SERVICE-WORKERS]
      Alex Russell; Jungkee Song; Jake Archibald. Service Workers. 25 June 2015. WD. URL: https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ -
      [TOUCH-EVENTS] +
      [TOUCH-EVENTS]
      Doug Schepers; et al. Touch Events. 10 October 2013. REC. URL: http://dvcs.w3.org/hg/webevents/raw-file/v1/touchevents.html -
      [UIEVENTS] +
      [UIEVENTS]
      Gary Kacmarcik; Travis Leithead. UI Events Specification. 15 December 2015. WD. URL: https://w3c.github.io/uievents/ -
      [XML] +
      [WebIDL] +
      Cameron McCormack; Boris Zbarsky. WebIDL Level 1. 4 August 2015. WD. URL: https://heycam.github.io/webidl/ +
      [WHATWG-ENCODING] +
      Anne van Kesteren. Encoding Standard. Living Standard. URL: https://encoding.spec.whatwg.org/ +
      [WHATWG-URL] +
      Anne van Kesteren; Sam Ruby. URL Standard. Living Standard. URL: https://url.spec.whatwg.org/ +
      [XML]
      Tim Bray; et al. Extensible Markup Language (XML) 1.0 (Fifth Edition). 26 November 2008. REC. URL: http://www.w3.org/TR/xml -
      [XML-NAMES] +
      [XML-NAMES]
      Tim Bray; et al. Namespaces in XML 1.0 (Third Edition). 8 December 2009. REC. URL: http://www.w3.org/TR/xml-names

      Informative References

      -
      [DOM-Level-2-Traversal-Range] +
      [CSSOM-VIEW] +
      Simon Pieters; Glenn Adams. CSSOM View Module. 17 December 2013. WD. URL: http://dev.w3.org/csswg/cssom-view/ +
      [DOM-Level-2-Traversal-Range]
      Joseph Kesselman; et al. Document Object Model (DOM) Level 2 Traversal and Range Specification. 13 November 2000. REC. URL: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ -
      [DOM-Level-3-Core] +
      [DOM-Level-3-Core]
      Arnaud Le Hors; et al. Document Object Model (DOM) Level 3 Core Specification. 7 April 2004. REC. URL: http://www.w3.org/TR/DOM-Level-3-Core/ -
      [DOM-Parsing] +
      [DOM-Parsing]
      Travis Leithead. DOM Parsing and Serialization. 17 June 2014. CR. URL: https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html -
      [ElementTraversal] +
      [ElementTraversal]
      Doug Schepers; Robin Berjon. Element Traversal Specification. 22 December 2008. REC. URL: http://www.w3.org/TR/ElementTraversal/ -
      [CSSOM-VIEW] -
      Simon Pieters; Glenn Adams. CSSOM View Module. 17 December 2013. WD. URL: http://dev.w3.org/csswg/cssom-view/ -
      [SELECTORS-API2] +
      [SELECTORS-API2]
      Lachlan Hunt. Selectors API Level 2. 17 October 2013. NOTE. URL: http://dev.w3.org/2006/webapi/selectors-api2/ -
      [UIEVENTS-20031107] +
      [UIEVENTS-20031107]
      Gary Kacmarcik; Travis Leithead. UI Events Specification. 7 November 2003. NOTE. URL: https://w3c.github.io/uievents/

      IDL Index