Object: CharacterData
The CharacterData object extends the Node object and can be used to access character data in the DOM. No DOM objects directly correspond to CharacterData; rather, the methods and properties are always inherited by other objects that require this functionality, such as Comment, Text, and CDATASection.
The content of this node is represented as UTF-16. CharacterData methods all work with numeric character offsets and text ranges, and manipulate ranges of text as a sequence of 16-bit units. Before invoking these methods, you should already know the ranges that you are manipulating.
CharacterData properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
DOMString |
Specifies the character data of the current node. |
writable |
DOM 2 Core |
4.6 or later |
|
|
int |
Returns the length of the content of the data property or the CharacterData.substringData() method. |
read only |
DOM 2 Core |
4.6 or later |
CharacterData methods
|
Method name |
Description |
Support level |
Availability |
|---|---|---|---|
|
Appends the given string to the end of the data of the node. |
DOM 2 Core |
4.6 or later |
|
|
Removes the specified range of data. |
DOM 2 Core |
4.6 or later |
|
|
Inserts a string at the specified location in the data. |
DOM 2 Core |
4.6 or later |
|
|
Replaces the specified range of data with the given string. |
DOM 2 Core |
4.6 or later |
|
|
Returns the specified range of data from the node. |
DOM 2 Core |
4.6 or later |