DOM:range.insertNode
From MDC
Contents |
[edit] Summary
Insert a node at the start of a Range.
[edit] Syntax
range.insertNode(newNode);
[edit] Parameters
- newNode
- is a Node.
[edit] Example
range = document.createRange();
newNode = document.createElement("p");
newNode.appendChild(document.createTextNode("New Node Inserted Here"));
range.selectNode(document.getElementsByTagName("div").item(0));
range.insertNode(newNode);
[edit] Notes
newNode is inserted at the start boundary point of the Range. If the newNodes is to be added to a text Node, that Node is split at the insertion point, and the insertion occurs between the two text Nodes (Blocked by bug 135922)
If newNode is a document fragment, the children of the document fragment are inserted instead.