Document.createComment

Create a comment

struct Document
createComment
(
string text
)

Examples

version(DigitalMars) scope(exit) assert(Document.RefCounter.refs.length == 0);
version(DigitalMars) scope(exit) assert(Element.RefCounter.refs.length == 0);


Document d = `<p>`;

Element p = d.body.firstChild;
Element t = d.createText("this is a test");
Element c = d.createComment("this is a comment");
p.appendChild(t);
p.appendChild(c);


assert(p == "<p>this is a test<!--this is a comment--></p>");

Meta