RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
IDOMNode.insertBefore Method

Inserts a new child node before a specified child of the node.

Pascal
function insertBefore(const newChild: IDOMNode; const refChild: IDOMNode): IDOMNode; safecall;
C++
__fastcall IDOMNode insertBefore(const IDOMNode newChild, const IDOMNode refChild);

Use insertBefore to add a child node at a specified position in this node's list of children. If the new node is already in the document's node hierarchy, it is first removed from its parent node. If this node is read-only, refChild is a node that is not in this node's child list, newChild was created using a different document, or if newChild is of a nodeType that is not permitted as a child of this node, insertBefore raises an exception. 

newChild is the child node to add. It can be a node that currently has another parent node, or a new node created using the methods of the document interface. If it is of nodeType DOCUMENT_FRAGMENT_NODE, the entire contents of the document fragment are moved into this node's childNodes property list. 

refChild is a child of this node before which to insert the new node. If refChild is nil (Delphi) or NULL (C++), the new node is added to the end of this node's child list. 

insertBefore returns the interface for the newly added child node. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!