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

  1. 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.
  2. 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.
  3. Methods

  4. The splitText(offset) method breaks the Text node into two Text nodes at the specified offset, keeping both in the tree as siblings.
  5. After the node is broken into two Text nodes, the original node contains all the contents up to the offset point.
  6. The new Text node contains all the contents at and after the offset point.
  7. The splitText(offset) method returns the new Text node.
  8. DOMExceptions

  9. 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.
  10. 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