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(string data)void deleteData(unsigned long offset, unsigned long count)void insertData(unsigned long offset, string data)void replaceData(unsigned long offset, unsigned long count, string data)string substringData(unsigned long offset, unsigned long count)

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.