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
oldNodein the tree withnewNode.If
pis the parent ofoldNode, this function needs to find a propertypropNameofpsuch thatp[propName] === oldNode.Once found, it re-assigns
p[propName] = newNodeand setsnewNode.parent=pusingacceptChildren. Sincechildrenis a getter there is nothing further to do.