Section 25.41. CharacterData: common functionality for Text and Comment nodes


25.41. CharacterData: common functionality for Text and Comment nodes

DOM Level 1 Core: Node CharacterData

25.41.1. Subinterfaces

Comment, Text

25.41.2. Properties


String data

The text contained by this node.


readonly unsigned long length

The number of characters contained by this node.

25.41.3. Methods


appendData( )

Appends the specified string to the text contained by this node.


deleteData( )

Deletes text from this node, starting with the character at the specified offset and continuing for the specified number of characters.


insertData( )

Inserts the specified string into the text of this node at the specified character offset.


replaceData( )

Replaces the characters starting at the specified character offset and continuing for the specified number of characters with the specified string.


substringData( )

Returns a copy of the text starting at the specified character offset and continuing for the specified number of characters.

25.41.4. Description

CharacterData is the superinterface for Text and Comment nodes. Documents never contain CharacterData nodes; they contain only Text and Comment nodes. Since both of these node types have similar functionality, however, that functionality has been defined here so that both Text and Comment can inherit it.

Note that it is not necessary to use the string-manipulation methods defined by this interface. The data property is an ordinary JavaScript string, and you can manipulate it with the + operator for string concatenation and with various String and RegExp methods.

25.41.5. See Also

Comment, Text




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net