HTMLDocument.AdoptNode

Syntax:

AdoptNode()

Returned value:

Type: HTMLNodeList; Undefined.
Adapted node or Undefined if adaptation failed.

Description:

Provides adaptation (adoption) of other document's node. Tries to adopt a node from another document.
If adaptation is supported for the node, then a recursive replacement is done of the document-owner in this node, all its children nodes and attributes.
If the node has a parent node, then at first it is removed from the parent node.
Adaptation rules for node types:
  • Attribute - document-owner is set in Undefined, Specified property is set to True;
  • DocumentFragment - all children of a fragment node are adapted recursively;
  • Document - cannot be adapted;
  • DocumentType - cannot be adapted;
  • Element - attributes with a set property; Specified are adapted, for a new node-element attributes are created with default values. All children are adapted recursively.
  • If an entity with the same name is defined in this document, then an entity value is formed for adapted reference;
  • Text and Comment - adapted.

Availability:

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

Note:

Exception call reasons:
  • An attampt of node adaptation Document, DocumentType;
  • Current document of adapted node is in read-only mode.

    

1C:Enterprise Developer's Community