Export (0) Print
Expand All

insertNode method

Inserts a node into the start of a Range object.

Document Object Model (DOM) Level 2 Traversal and Range Specification, Section 2.13Internet Explorer 9

Syntax

Range.insertNode(oNode);

Parameters

oNode [in]

Type: Node

The new node to insert.

Return value

This method does not return a value.

Exceptions

ExceptionCondition
InvalidStateError

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, 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.

See also

Range

 

 

Show:
© 2014 Microsoft