DOMComment (JavaScript)

Represents a comment.

Defined in

DOM (JavaScript)

Methods

This class inherits the methods of DOMNode (JavaScript) and DOMCharacterData (JavaScript).

Usage

See createComment in DOMDocument to create a comment node with specified text.

This class has no methods of its own but can use the inherited methods to manipulate the text and the node.

Examples

This button creates a document with a hierarchy of elements and comments.
var generic = " comment goes here.";
var doc = database.createNewDocument();
var dom = doc.getDOM();
var schema0 = dom.createElement("schema0");
var element0 = dom.createElement("element0");
var commentd = dom.createComment(generic);
commentd.insertData(0, "DOM");
dom.appendChild(commentd);
dom.appendChild(schema0);
var comments = dom.createComment(generic);
comments.insertData(0, "Schema");
schema0.appendChild(comments);
schema0.appendChild(element0);
element0.setStringValue(requestScope.s);
var commente = dom.createComment(generic);
commente.insertData(0, "Element");
element0.appendChild(commente);
doc.save()
The XML for this document might appear as follows:
<!--DOM comment goes here.-->
<schema0>
  <!--Schema comment goes here.-->
  <element0>foo
    <!--Element comment goes here.-->
  </element0>
</schema0>