DOMElement.ReplaceChild

Syntax:

ReplaceChild(<NewNode>, <OldNode>)

Parameters:

<NewNode> (required)

Type: DOMElement.
A new child node.

<OldNode> (required)

Type: DOMElement.
The existing child node.

Returned value:

Type: DOMElement.
The previous node value.

Description:

Replaces a child node specified in the <OldNode> parameter by a node specified in the <NewNode> parameter. If the new node is DocumentFragment, the replaced node will be replaced by all child nodes of the document fragment. If the new node 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:

An exception is triggered:
  • if the given node does not allow the node being added as a child node or if the added node is a parent for the given.
  • if the node is added to itself.
  • if the given node - Document and the second node DocumentType or Element is added.
  • if the node being added was created by the document different from the one that created the given node.
  • if the given node is in the read-only mode or if the previous parent of the added node in the Read-only mode.
  • if the replaced node is not found.
  • if the added node is a child node for the Document node and implementation does not support deleting DocumentType and Element nodes from the Document node.

    

1C:Enterprise Developer's Community