Text Interface
The Text interface represents the textual content of an Element or Attr.
IDL Definition
Interface Text : CharacterData {
Text splitText(in unsigned long offset)
raises (DOMException);
};
Semantic Requirements
- If there is no markup inside an element's content then the text is
contained into a single object implementing the Text
interface that is the only child of the element.
- If there is markup inside the element's content then the content is parsed into a list of elements and Text nodes that form the list of children of the element.
Methods
- The splitText(offset) method breaks the Text node into two Text nodes at the specified offset, keeping both in the tree as
siblings.
- After the node is broken into two Text nodes, the original node contains all
the contents up to the offset point.
- The new Text node contains all the contents at and after the offset
point.
- The splitText(offset) method returns the new Text node.
DOMExceptions
- The splitText(offset) method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative or greater than the number of 16-bit units in data.
- The splitText(offset) method raises a NO_MODIFICATION_ALLOWED_ERR DOMException if the node is readonly.
If you have comments or suggestions, email me at mbrady@nist.gov