giokincade/astronaut — pull request #3 by danielmendel (2014-07-03 20:53:32+00:00)
Title: Update pointer to node during walk

While walking the tree, if a node is wrapped or replaced during the
`callback` it doesn't update the node being iterated on inside `walk`,
which means the rest of the walk callbacks are firing for elements no
longer in the main tree. This resets the reference to the given node
during the walk phase after each callback executes. This is a
fundimental departure, as it means implementations using walk that are
not read-only will have to always check to ensure that a given node has
not already been wrapped since nodes being wrapped get the callback fired
*twice*. You can see this in the updated test, which without these
additional checks would result in a stack overflow.