Replace the node oldNode in the tree with newNode.
If p is the parent of oldNode, this function needs to find a property
propName of p such that p[propName] === oldNode.
Once found, it re-assigns p[propName] = newNode and sets
newNode.parent=p using acceptChildren. Since children is a getter
there is nothing further to do.
Replace the node
oldNode
in the tree withnewNode
.If
p
is the parent ofoldNode
, this function needs to find a propertypropName
ofp
such thatp[propName] === oldNode
.Once found, it re-assigns
p[propName] = newNode
and setsnewNode.parent=p
usingacceptChildren
. Sincechildren
is a getter there is nothing further to do.