Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

CharacterData

BaselineWidely available

TheCharacterData abstract interface represents aNode object that contains characters. This is an abstract interface, meaning there aren't any objects of typeCharacterData: it is implemented by other interfaces likeText,Comment,CDATASection, orProcessingInstruction, which aren't abstract.

EventTarget Node CharacterData

Instance properties

This interface also inherits properties from its parents,Node andEventTarget.

CharacterData.data

A string representing the textual data contained in this object.

CharacterData.lengthRead only

Returns a number representing the size of the string contained in the object.

CharacterData.nextElementSiblingRead only

Returns the firstElement thatfollows this node, and is a sibling.

CharacterData.previousElementSiblingRead only

Returns the firstElement thatprecedes this node, and is a sibling.

Instance methods

This interface also inherits methods from its parents,Node andEventTarget.

CharacterData.after()

Inserts a set ofNode objects or strings in the children list of theCharacterData's parent, just after theCharacterData object.

CharacterData.appendData()

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

CharacterData.before()

Inserts a set ofNode objects or strings in the children list of theCharacterData's parent, just before theCharacterData object.

CharacterData.deleteData()

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

CharacterData.insertData()

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

CharacterData.remove()

Removes the object from its parent children list.

CharacterData.replaceData()

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

CharacterData.replaceWith()

Replaces the characters in the children list of its parent with a set ofNode objects or strings.

CharacterData.substringData()

Returns a string containing the part ofCharacterData.data of the specified length and starting at the specified offset.

Specifications

Specification
DOM
# interface-characterdata

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp