null, insert newChild at the end of the list of children.
@param newChild The node to insert
@param refChild The reference node (that is, the node before which the newnode must be inserted), or null
@return The node being inserted
newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children. newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed. Note: Inserting a node before itself is implementation dependent.
@param newChild The node to insert.
@param refChild The reference node, i.e., the node before which the new node must be inserted.
@return The node being inserted.
@exception DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to insert a second DocumentType or Element node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.
NOT_FOUND_ERR: Raised if refChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the insertion of a DocumentType or Element node.
@since DOM Level 3
null if ungrouped
@throws IllegalArgumentException if the node or element is null, or if the node is not part of this rewriter's AST, or if the inserted node is not a new node (or placeholder), or if element is not a member of the list (original or new), or if the described modification is otherwise invalid
null if ungrouped
@throws IllegalArgumentException if the node or element is null,or if the node is not part of this rewriter's AST, or if the inserted node is not a new node (or placeholder), or if element is not a member of the list (original or new), or if the described modification is otherwise invalid
Adds a new children to the node, positioned just before another child node that is also specified.
This method is effectively equivalent to first searching the existing child and then executing {@link #insertChild(int,Node)}specifying its position.
@param existingChild the child we want to insert the new child just before. @param newChild the new child.newChild before the existing child node refChild . If refChild is null , insert newChild at the end of the list of children. newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild . If the newChild is already in the tree, it is first removed.
@param newChild The node to insert.
@param refChild The reference node, i.e., the node before which the new node must be inserted.
@return The node being inserted.
@exception DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors. newChild was created from a different document than the one that created this node. refChild is not a child of this node.
You could use {@link #setParent} or {@link #appendChild}instead of this method, unless you want to control where to put the child.
Note: {@link #setParent} always calls back {@link #insertBefore}and/or {@link #removeChild}, while {@link #insertBefore} and {@link #removeChild}always calls back {@link #setParent}, if the parent is changed. Thus, you don't need to override both {@link #insertBefore} and {@link #setParent}, if you want to customize the behavior. @param newChild the new child to be inserted. @param refChild the child before which you want the new childbeing inserted. If null, the new child is append to the end. @return true if newChild is added successfully or moved;false if it already has the specified child and the order doesn't change.
| |
| |
| |
| |
| |
| |
| |
| |
| |