CharacterData — Inherits Node
The CharacterData
interface is a subtype of Node
that provides additional methods for working with text data. This
interface does not correspond to concrete node types, but is used as
a basis for defining the Text
and
Comment
interfaces.
data
This string represents the character data held within the node.
length
The number of characters available through the data
attribute and substringData
method. If the object
is empty, the value may be 0
.
appendData(
arg
)
This method appends the string
arg
to the end of the character
data.
deleteData(
offset, count
)
Removes a given number of characters from the character
data beginning at offset
and
continuing through offset
+
count
. If the supplied range
exceeds the length of the string, the contents from
offset
through the end of the
string are deleted.
insertData(
offest, arg
)
This method allows you to insert character data into the
node beginning at the position noted by
offset
.
replaceData(
offset, count, arg
)
This method replaces the data beginning at offset, with
the supplied data of arg
,
continuing through offset
+
count
. If the length of the data is
exceeded, then the additional replacement text is appended to
the data.
substringData(
offset, count
)
Extracts a portion of the data from the CharacterData
node. If
offset
+
count
exceed the length, then all
characters through the end of the node are returned.
18.191.93.12