CharacterData

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

A interface abstrata CharacterData representa um objeto Node que contém caracteres. Esta é uma interface abstrata, o que significa que não há nenhum objeto do tipo CharacterData: ela é implementada por outras interfaces, como Text, Comment ou ProcessingInstruction, que não são abstratas.

EventTarget Node CharacterData

Propriedades

Herda propriedades de seu pai, Node, e implementa as interfaces ChildNode e NonDocumentTypeChildNode.

CharacterData.data

É um DOMString representando os dados textuais contidos neste objeto.

CharacterData.length Somente leitura

Retorna um unsigned long representando o tamanho da string contida em CharacterData.data.

NonDocumentTypeChildNode.nextElementSibling Somente leitura

Returns the Element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list.

NonDocumentTypeChildNode.previousElementSibling Somente leitura

Returns the Element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list.

Methods

Inherits methods from its parent, Node, and implements the ChildNode and NonDocumentTypeChildNode interface.

CharacterData.appendData()

Appends the given DOMString to the CharacterData.data string; when this method returns, data contains the concatenated DOMString.

CharacterData.deleteData()

Removes the specified amount of characters, starting at the specified offset, from the CharacterData.data string; when this method returns, data contains the shortened DOMString.

CharacterData.insertData()

Inserts the specified characters, at the specified offset, in the CharacterData.data string; when this method returns, data contains the modified DOMString.

ChildNode.remove() Experimental

Removes the object from its parent children list.

CharacterData.replaceData()

Replaces the specified amount of characters, starting at the specified offset, with the specified DOMString; when this method returns, data contains the modified DOMString.

CharacterData.substringData()

Returns a DOMString containing the part of CharacterData.data of the specified length and starting at the specified offset.

Specifications

Specification
DOM
# interface-characterdata

Compatibilidade com navegadores

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
CharacterData
after
appendData
before
data
deleteData
insertData
length
nextElementSibling
previousElementSibling
remove
replaceData
replaceWith
substringData

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also