From c8432766a1419ffee7372f4061dbc2d6208132ec Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Fri, 27 Nov 2015 00:54:11 +0100 Subject: [PATCH] Close #122: fix mutation record for a removing a node A node's next sibling needs to be stored before removing the node from its parent. --- dom.bs | 15 ++++++++++++--- dom.html | 12 +++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/dom.bs b/dom.bs index d85bd9221..92b0d776c 100644 --- a/dom.bs +++ b/dom.bs @@ -1600,6 +1600,14 @@ steps: node into parent's node document. +
  • If child's parent is null, let removedNodes be the empty list. + +

    The above can only happen if child is node. + +

  • Otherwise, remove child from its parent with the + suppress observers flag set and let removedNodes be a list + containing solely child. +
  • Remove child from its parent with the suppress observers flag set. @@ -1722,8 +1730,9 @@ steps: node document, run the NodeIterator pre-removing steps given node and iterator. -
  • Let oldPreviousSibling be node's - previous sibling +
  • Let oldPreviousSibling be node's previous sibling. + +
  • Let oldNextSibling be node's next sibling.
  • Remove node from its parent. @@ -1742,7 +1751,7 @@ steps:
  • If suppress observers flag is unset, queue a mutation record of "childList" for parent with removedNodes a list solely containing node, - nextSibling node's next sibling, and previousSibling + nextSibling oldNextSibling, and previousSibling oldPreviousSibling. diff --git a/dom.html b/dom.html index 7123d2fc8..822f39cfc 100644 --- a/dom.html +++ b/dom.html @@ -69,7 +69,7 @@

    DOM

    -

    Living Standard — Last Updated

    +

    Living Standard — Last Updated

    Participate: @@ -982,6 +982,11 @@

    Let previousSibling be child’s previous sibling.

  • Adopt node into parent’s node document. +
  • + If child’s parent is null, let removedNodes be the empty list. +

    The above can only happen if child is node.

    +
  • Otherwise, remove child from its parent with the suppress observers flag set and let removedNodes be a list + containing solely child.
  • Remove child from its parent with the suppress observers flag set.
  • Let nodes be node’s children if node is a DocumentFragment node, and a list containing solely node otherwise.
  • Insert node into parent before reference child with @@ -1020,13 +1025,14 @@

    For each range whose end node is parent and end offset is greater than index, decrease its end offset by one.
  • For each NodeIterator object iterator whose root’s node document is node’s node document, run the NodeIterator pre-removing steps given node and iterator.

    -
  • Let oldPreviousSibling be node’s previous sibling +
  • Let oldPreviousSibling be node’s previous sibling. +
  • Let oldNextSibling be node’s next sibling.
  • Remove node from its parent.
  • Run the removing steps with node, parent, and oldPreviousSibling.
  • For each inclusive ancestor ancestor of parent, if ancestor 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.
  • If suppress observers flag is unset, queue a mutation record of "childList" for parent with removedNodes a list solely containing node, - nextSibling node’s next sibling, and previousSibling oldPreviousSibling. + nextSibling oldNextSibling, and previousSibling oldPreviousSibling.

    4.2.2. Interface NonElementParentNode

    The getElementById() method is not