Name
Comment — an HTML or XML comment
Inherits from
Node
Synopsis
A Comment node represents a comment in an HTML or XML
document. The content of the comment (i.e., the text between
<!--
and -->
) is available through the data
property or through the nodeValue
property inherited from Node.
You can create a comment object with
Document
.
createComment()
.
Properties
string
data
The text of the comment.
readonly unsigned long
length
The number of characters in the comment.
Methods
void
appendData
(stringdata
)void
deleteData
(unsigned longoffset
, unsigned longcount
)void
insertData
(unsigned longoffset
, stringdata
)void
replaceData
(unsigned longoffset
, unsigned longcount
, stringdata
)string
substringData
(unsigned longoffset
, unsigned longcount
)Comment nodes have most of the methods of a Text node, and those methods work as they do on Text nodes. They are listed here, but see Text for documentation.
Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.