TOC PREV NEXT INDEX

domref



surroundContents


Moves content of a Range into a new node.

Syntax

range.surroundContents(newNode);
 

Parameters

newNode a Node

Example

range = document.createRange();
 
newNode = document.createElement("p"):
 
range.selectNode(document.getElementsByTagName("div").item(0));
 
range.surroundContents(newNode);
 

Notes

surroundContents is equivalent to newNode.appendChild(range.extractContents());range.insertNode(newNode). After surrounding, the boundary points of the Range include newNode. (Hindered by http://bugzilla.mozilla.org/show_bug.cgi?id=135928 )

Specification

surroundContents


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX