Help Center

Local Navigation

Object: CharacterData

Availability

BlackBerry® Device Software version 4.6 or later

Extends

Node

Extended by

Comment, Text

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

data

DOMString

Specifies the character data of the current node.

writable

DOM 2 Core

4.6 or later

length

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

appendData()

Appends the given string to the end of the data of the node.

DOM 2 Core

4.6 or later

deleteData()

Removes the specified range of data.

DOM 2 Core

4.6 or later

insertData()

Inserts a string at the specified location in the data.

DOM 2 Core

4.6 or later

replaceData()

Replaces the specified range of data with the given string.

DOM 2 Core

4.6 or later

substringData()

Returns the specified range of data from the node.

DOM 2 Core

4.6 or later

Next topic: Object: Comment
Previous topic: Object: CDATASection

Was this information helpful? Send us your comments.