Share via


insertNode method

Inserts a node into the start of a Range object.

 

Syntax

object.insertNode(oNode);

Parameters

  • oNode [in]
    Type: Node

    The new node to insert.

Return value

This method does not return a value.

Exceptions

Exception Condition
InvalidStateError

IHTMLDOMRange::detach has been invoked on the object.

HierarchyRequestError

A document type node is included in the range that is being cloned. Versions earlier than Internet Explorer 10 return W3Exception_DOM_HIERARCHY_REQUEST_ERR.

NoModificationAllowedError

Some of the contents or nodes are read-only. Versions earlier than Internet Explorer 10 return W3Exception_DOM_NO_MODIFICATION_ALLOWED_ERR.

WrongDocumentError

newNode and the container for the start of the range were not created from the same document. Versions earlier than Internet Explorer 10 return W3Exception_DOM_WRONG_DOCUMENT_ERR.

 

Standards information

Remarks

If the container is of type  TextNode, IHTMLDOMRange::insertNode splits the text node, and inserts newNode between the resulting two text nodes.

If newNode is a document fragment, the children of the document fragment node are inserted rather than the newNode itself.