Share via


cloneNode method

Produces an identical copy, or clone, of the node.

Syntax

HRESULT retVal = object.cloneNode(fDeep, clonedNode);

Parameters

fDeep [in]

Type: VARIANT_BOOL

VARIANT_BOOL that specifies whether to copy the subtree of the node.

VARIANT_TRUE (true)

Copy the node's subtree recursively.

VARIANT_FALSE (false)

Default. Copy only the node, including any attributes.

clonedNode [out, retval]

Type: IHTMLDOMAttribute

A pointer to an IHTMLDOMAttribute interface that receives a reference to the copy of the node.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

IHTMLDOMAttribute2::cloneNode was introduced in Microsoft Internet Explorer 6.

The IHTMLDOMAttribute2::parentNode property of the copy of the node is NULL.

This method copies all of the node's attributes and their values. It does not copy any text that the node contains, unless the fDeep parameter is set to true, because the text is contained in a child TextNode object.

An attribute object is copied directly, instead of an attribute that is copied as part an element that is copied, returns a IHTMLDOMAttribute::specified attribute (IHTMLDOMAttribute::specified is true). By copying any other type of node, a copy of this node is returned.

See also

Reference

IHTMLDOMNode::cloneNode

Conceptual

About the W3C Document Object Model