Sign in Join
FPDoc Onlineexperiment

TDOMDocumentFragment.CloneNode function

Member of TDOMDocumentFragmentpublicIn unit Laz2_DOM

Creates a copy of the document fragment with optional recursion into child nodes.

Declaration

pascal
function CloneNode(deep: Boolean; ACloneOwner: TDOMDocument): TDOMNode
 ; override; overload

Arguments

deep

Indicates if child nodes are included in the cloned document fragment.

ACloneOwner

Document used as the owner of the cloned document fragment.

Function result

The new copy of the document fragment.

Description

CloneNode is a method used to create a document fragment with the content specified in ACloneOwner, the OwnerDocument for the clone. CloneNode implements the method defined for the Node interface in the DOM Level 2 specification.

CloneNode creates a new TDOMNode instance that is a duplicate of the document fragment node by calling the CreateDocumentFragment method in ACloneOwner. This causes ACloneOwner to be assigned as the OwnerDocument for the new node. The new node does not have a ParentNode.

The deep argument indicates if the child nodes in ACloneOwner are also duplicated in the method. When deep is True, the CloneChildren method is called to duplicate the child nodes (recursively). Cloning a DOM Element node using deep recursion also copies its attribute names and values. Set deep to False to limit the copy to the immediate node and its Attributes.

The return value contains a TDOMNode instance with the duplicated content for the node in ACloneOwner.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.