DOMDocument.InsertBefore

Syntax:

InsertBefore(<NewNode>, <Node>)

Parameters:

<NewNode> (required)

Type: DOMDocument.
The inserted DOM node.

<Node> (required)

Type: DOMDocument.
A node before which you should insert the node specified in the <NewNode> parameter. If the parameter is not set, the node is added to the end of the child node list.

Returned value:

Type: DOMDocument.

Description:

Inserts a node into the list of child nodes before the existing child node specified in the <Node> parameter. If the inserted node is the DocumentFragment node, all of its child nodes are inserted before the node specified in the <Node> parameter in the original order. If a node specified in the <NewNode> parameter is already included in the document tree, it is first deleted from the child nodes of the previous parent and then is inserted into the child node list of the new parent.

Availability:

Server, thick client, external connection, Mobile application (server).

Note:

Exception reasons:
  • This node does not allow a node to be added as a child node, or the added node is one of its parents, or the node is added to itself, or this node is Document and the added node is DocumentType or Element;
  • The added node is created by a document different from the document that has created this node;
  • This node is read-only or the previous parent of the added node is read-only;
  • The node before which another node is added cannot be found

    

1C:Enterprise Developer's Community