[Overview][Constants][Types][Classes][Procedures and functions][Index] |
Inserts a new child node immediately before the reference child node.
Source position: laz2_dom.pas line 328
public function TDOMNode_WithChildren.InsertBefore( |
NewChild: TDOMNode; |
RefChild: TDOMNode |
):TDOMNode; override; |
NewChild |
|
Child node inserted in the method. |
RefChild |
|
Reference child node where the new DOM node is inserted as a Sibling. |
DOM Node inserted into the DOM sub-tree.
InsertBefore is a TDOMNode function used to insert a new child node immediately before the reference child node. InsertBefore is an overridden function that re-implements the method defined in the ancestor class.
NewChild contains the Node inserted into the DOM sub-tree for the current DOM Node. RefChild contains the Node that establishes the position where the NewChild Node is inserted in the DOM sub-tree. When RefChild is not assigned (contains Nil), the new child node is appended as a sibling in the DOM sub-tree. No actions are performed in the method when NewChild and RefChild contains the same DOM node.
InsertBefore uses the value in the NodeType property for the NewChild node to determine the actions needed to add the node to the DOM sub-tree. NodeType determines if NewChild requires additional processing before it is added to the DOM sub-tree. Some DOM Node types cannot be added directly to the sub-tree. Only their child nodes are added. No actions are performed for these DOM Node specialization when they do not contain child nodes. InsertBefore raises an EDOMHierarchyRequest exception if ChildNode is not a valid child node type for the current DOM node.
InsertBefore updates the parent, sibling, and child relationships in DOM nodes as they are inserted (or appended) to the DOM sub-tree. The return value contains the NewChild argument with updated values in its ParentNode, PreviousSibling and NextSibling properties.
InsertBefore checks the ParentNode for the RefChild argument to ensure that it resides in the DOM sub-tree for the current DOM Node. An EDOMNotFound exception is raised when it has an assigned value other than the current DOM Node.
InsertBefore calls the Changing method to ensure that neither the current DOM Node nor its ancestor have their read-only Flags set. An exception is raised in Changing if Flags contains the value nfReadonly in either DOM Node.
When the NodeType is DOCUMENT_TYPE_NODE, the OwnerDocument property is examined. An EDOMWrongDocument exception is raised when the NewChild has an assigned value in the OwnerDocument property.
|
Node type for the DOM Node. |
|
|
DOM node that is the immediate ancestor of this node. |
|
|
Previous DOM Node at the same level in the DOM tree. |
|
|
Next DOM Node at the same level in the DOM tree. |
|
|
Gets the first child node for the current node. |
|
|
Gets the last child node for the current node. |
|
|
DOM Document that created the DOM node. |
|
|
Inserts a new child node immediately before the reference child node. |
Version 3.2 | Generated 2024-02-25 | Home |