XML DOM - Text object
- Página anterior RangeException DOM
- Próxima página XMLHttpRequest DOM
The Text object represents the text content of an element or attribute.
Text object description
The Text node represents a series of plain text in an HTML or XML document. Since plain text appears in the elements and attributes of HTML and XML, the Text node usually appears as a child node of Element nodes and Attr nodes.
The Text node inherits CharacterData interfaceThe text content of a Text node can be accessed through the data property inherited from the CharacterData interface or the nodevalue property inherited from the Node interface.
Methods or the splitText() method defined by the Text interface itself, inherited from CharacterData, can be used to manipulate Text nodes. A new Text node can be created using document.createTextNode().
O nó Text não tem subnós.
Sobre o método de exclusão de nós Text vazios do subárvores do documento e a fusão de nós Text adjacentes, consulte "Node.normalize()Página de referência "
Atributos do objeto Text
Atributo | Descrição | IE | F | O | W3C |
---|---|---|---|---|---|
data | Define ou retorna o texto do elemento ou do atributo | 6 | 1 | 9 | Sim |
isElementContentWhitespace | Determina se o nó de texto contém conteúdo de caracteres em branco. | Não | Não | Não | Sim |
length | Retorna o comprimento do texto do elemento ou do atributo | 6 | 1 | 9 | Sim |
wholeText | Retorna todos os textos dos nós de texto adjacentes a este nó na ordem do documento | Não | Não | Não | Sim |
Métodos do objeto Text
Método | Descrição | IE | F | O | W3C |
---|---|---|---|---|---|
appendData() | Adicionar dados ao nó | 6 | 1 | 9 | Sim |
deleteData() | Excluir dados do nó | 6 | 1 | 9 | Sim |
insertData() | Inserir dados no nó | 6 | 1 | 9 | Sim |
replaceData() | Substituir os dados do nó | 6 | 1 | 9 | Sim |
replaceWholeText() | Substituir o texto especificado neste nó e todos os nós de texto adjacentes | Não | Não | Não | Sim |
splitText() | Dividir um nó Text em dois. | 6 | 1 | 9 | Sim |
substringData() | Extrair dados do nó | 6 | 1 | 9 | Sim |
Páginas relacionadas
Manual do XML DOM:Objeto CharacterData
- Página anterior RangeException DOM
- Próxima página XMLHttpRequest DOM