@verb #5406:":appendChild" this none this rxdo #7788 @program #5406:":appendChild" this none this " Node appendChild(in Node newChild) raises (DOMException);" "" "Adds the node newChild to the end of the list of children of this node. If newChild is already in the tree, then it is first removed." "" " newChild of type Node -> The node to add. If it is a DocumentFragment node, the children of the document fragment are added, not the fragment itself." {newChild} = args "check that we have the right document" if (newChild->__ownerDocument != this->__ownerDocument && newChild->__ownerDocument != this) $dom:raise_exception($dom.wrong_document_err) endif "check that newChild is not ourselves or our ancestors" par = newChild while (par != $dom.null) if (par == this) $dom:raise_exception($dom.hierarchy_request_err) endif par = par->__parentNode endwhile if (newChild->isa($dom_documentfragment)) for child in ($dom_document->__children) this->appendChild($dom:instanciate(child[3], newChild, newChild->__ownerDocument)) endfor return newChild endif if (newChild->__parentNode != $dom.null) newChild->__parentNode->removeChild(newChild) endif "conf that newChild->__parentNode is $dom.null here for storage as text. otherwise, toliteral(newChild) would describe the entire document, where we want it to contain just the branch" newChild->__parentNode = $dom.null newChild->__ownerDocument = $dom.null this->__children = {@this->__children, {newChild->__nodeType, newChild->__nodeId, toliteral(newChild)}} "now that it's stored as text, we can set the __parentNode attr to ourselves." newChild->__parentNode = this newChild->__ownerDocument = this->__ownerDocument $dom:updateParentsChildren(this) return newChild "Last modified by Floyd (#7788) on Fri Nov 15 21:31:19 2002 MST." .