Home to Document Object Model | Up to Core
Prev Comment | Next Document


Text
Object (inherits from Node and CharacterData).

This object represents the text within a section of markup (e.g. the text parts of the content of an Element) or the value of an Attribute.

Text nodes do not have child nodes.

splitText
Method
ECMAScript binding: splitText(offset) (returns Text; offset is a Number; can raise DOMException)

This node is split in two at offset. The text beyond this point forms the next sibling of this node in the tree. This node is truncated.

Returns the new node created (which will be a Text node or, in some later DOM, an extension of a Text node).

The exceptions thrown are:

INDEX_SIZE_ERR
offset is negative or exceeds this.length.
NO_MODIFICATION_ALLOWED_ERR
The node is read only.