--- title: CharacterData slug: Web/API/CharacterData translation_of: Web/API/CharacterData --- <p>{{APIRef("DOM")}}</p> <p>A interface abstrata <strong>CharacterData </strong>representa um objeto {{domxref("Node")}} que contém caracteres. Esta é uma interface abstrata, o que significa que não há nenhum objeto do tipo <code>CharacterData</code>: ela é implementada por outras interfaces, como {{domxref("Text")}}, {{domxref("Comment")}} ou {{domxref("ProcessingInstruction")}}, que não são abstratas.</p> <p>{{InheritanceDiagram}}</p> <h2 id="Propriedades">Propriedades</h2> <p><em>Herda propriedades de seu pai, {{domxref("Node")}}, e implementa as interfaces {{domxref("ChildNode")}} e {{domxref("NonDocumentTypeChildNode")}}.</em></p> <dl> <dt>{{domxref("CharacterData.data")}}</dt> <dd>É um {{domxref("DOMString")}} representando os dados textuais contidos neste objeto.</dd> <dt>{{domxref("CharacterData.length")}} {{readonlyInline}}</dt> <dd>Retorna um <code>unsigned long</code> representando o tamanho da string contida em <code>CharacterData.data</code>.</dd> <dt>{{domxref("NonDocumentTypeChildNode.nextElementSibling")}} {{readonlyInline}}</dt> <dd>Returns the {{domxref("Element")}} immediately following the specified one in its parent's children list, or <code>null</code> if the specified element is the last one in the list.</dd> <dt>{{domxref("NonDocumentTypeChildNode.previousElementSibling")}} {{readonlyInline}}</dt> <dd>Returns the {{domxref("Element")}} immediately prior to the specified one in its parent's children list, or <code>null</code> if the specified element is the first one in the list.</dd> </dl> <h2 id="Methods" name="Methods">Methods</h2> <p><em>Inherits methods from its parent, {{domxref("Node")}}, and implements the {{domxref("ChildNode")}} <em>and {{domxref("NonDocumentTypeChildNode")}} </em>interface.</em></p> <dl> <dt>{{domxref("CharacterData.appendData()")}}</dt> <dd>Appends the given {{domxref("DOMString")}} to the <code>CharacterData.data</code> string; when this method returns, <code>data</code> contains the concatenated {{domxref("DOMString")}}.</dd> <dt>{{domxref("CharacterData.deleteData()")}}</dt> <dd>Removes the specified amount of characters, starting at the specified offset, from the <code>CharacterData.data</code> string; when this method returns, <code>data</code> contains the shortened {{domxref("DOMString")}}.</dd> <dt>{{domxref("CharacterData.insertData()")}}</dt> <dd>Inserts the specified characters, at the specified offset, in the <code>CharacterData.data</code> string; when this method returns, <code>data</code> contains the modified {{domxref("DOMString")}}.</dd> <dt>{{domxref("ChildNode.remove()")}} {{experimental_inline}}</dt> <dd>Removes the object from its parent children list.</dd> <dt>{{domxref("CharacterData.replaceData()")}}</dt> <dd>Replaces the specified amount of characters, starting at the specified offset, with the specified {{domxref("DOMString")}}; when this method returns, <code>data</code> contains the modified {{domxref("DOMString")}}.</dd> <dt>{{domxref("CharacterData.substringData()")}}</dt> <dd>Returns a {{domxref("DOMString")}} containing the part of <code>CharacterData.data</code> of the specified length and starting at the specified offset.</dd> </dl> <h2 id="Specification" name="Specification">Specifications</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> <tr> <td>{{SpecName('DOM WHATWG', '#characterdata', 'CharacterData')}}</td> <td>{{Spec2('DOM WHATWG')}}</td> <td>Added implemention of the {{domxref("ChildNode")}} and {{domxref("NonDocumentTypeChildNode")}} interface.</td> </tr> <tr> <td>{{SpecName('DOM3 Core', 'core.html#ID-FF21A306', 'CharacterData')}}</td> <td>{{Spec2('DOM3 Core')}}</td> <td>No change from {{SpecName('DOM2 Core')}}.</td> </tr> <tr> <td>{{SpecName('DOM2 Core', 'core.html#ID-FF21A306', 'CharacterData')}}</td> <td>{{Spec2('DOM2 Core')}}</td> <td>No change from {{SpecName('DOM1')}}.</td> </tr> <tr> <td>{{SpecName('DOM1', 'level-one-core.html#ID-FF21A306', 'CharacterData')}}</td> <td>{{Spec2('DOM1')}}</td> <td>Initial definition.</td> </tr> </tbody> </table> <h2 id="Browser_compatibility">Compatibilidade com navegadores</h2> <p> </p> <p>{{Compat("api.CharacterData")}}</p> <h2 id="See_also">See also</h2> <p> </p> <ul> <li><a href="/en-US/docs/DOM/DOM_Reference" title="/en-US/docs/DOM/DOM_Reference">The DOM interfaces index</a>.</li> </ul>