Esta página foi traduzida do inglês pela comunidade.Saiba mais e junte-se à comunidade MDN Web Docs.
CharacterData
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since julho de 2015.
A interface abstrataCharacterData representa um objetoNode que contém caracteres. Esta é uma interface abstrata, o que significa que não há nenhum objeto do tipoCharacterData: ela é implementada por outras interfaces, comoText,Comment ouProcessingInstruction, que não são abstratas.
In this article
Propriedades
Herda propriedades de seu pai,Node, e implementa as interfacesChildNode eNonDocumentTypeChildNode.
CharacterData.dataÉ um
DOMStringrepresentando os dados textuais contidos neste objeto.CharacterData.lengthSomente leituraRetorna um
unsigned longrepresentando o tamanho da string contida emCharacterData.data.NonDocumentTypeChildNode.nextElementSiblingSomente leituraReturns the
Elementimmediately following the specified one in its parent's children list, ornullif the specified element is the last one in the list.NonDocumentTypeChildNode.previousElementSiblingSomente leituraReturns the
Elementimmediately prior to the specified one in its parent's children list, ornullif the specified element is the first one in the list.
Methods
Inherits methods from its parent,Node, and implements theChildNode andNonDocumentTypeChildNode interface.
CharacterData.appendData()Appends the given
DOMStringto theCharacterData.datastring; when this method returns,datacontains the concatenatedDOMString.CharacterData.deleteData()Removes the specified amount of characters, starting at the specified offset, from the
CharacterData.datastring; when this method returns,datacontains the shortenedDOMString.CharacterData.insertData()Inserts the specified characters, at the specified offset, in the
CharacterData.datastring; when this method returns,datacontains the modifiedDOMString.ChildNode.remove()ExperimentalRemoves 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,datacontains the modifiedDOMString.CharacterData.substringData()Returns a
DOMStringcontaining the part ofCharacterData.dataof the specified length and starting at the specified offset.
Specifications
| Specification |
|---|
| DOM> # interface-characterdata> |