Table 3


Node Interface methods.

MethodDescription
insertBefore Takes the name of a new node and a reference to an existing child node in the document tree and inserts the new node. If the reference is excluded, the new node is added to the end of the Node list. If the new child is a DocumentFragment object, all of its children are inserted, in the same order, before the reference. If the new child is already in the tree, it is first removed.
replaceChild Takes the name of an existing child and replaces it with the newly specified child node. If the new child is already in the tree, it is first removed. The value returned is the node that was replaced.
removeChild Takes the name of a child node and removes it from the Node list. Re-turns the name of the node to be removed.
appendChild Takes the name of a new child node and adds it to the end of the node's list of child nodes. The new child is removed from its previous position if it was already in the tree. If the operation was successful, the new node is returned.
hasChildNodes Checks the current node for the existence of child nodes and returns a Boolean value depending on whether the operation succeeded (True) or failed (False). This interface takes no parameters.
cloneNode Clones (or copies) the current node and returns the copy.