Comment()

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The Comment() constructor returns a newly created Comment object with the optional DOMString given in parameter as its textual content.

Syntax

comment1 = new Comment(); // Create an empty comment
comment2 = new Comment("This is a comment");

Example

var comment = new Comment("Test");

Specifications

Specification Status Comment
DOM
The definition of 'Comment.Comment()' in that specification.
Living Standard Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome Full support YesEdge Full support YesFirefox Full support 24IE No support NoOpera Full support YesSafari ? WebView Android ? Chrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 24Opera Android Full support YesSafari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also

 

Document Tags and Contributors

Contributors to this page: fscholz, jsx, tregagnon, teoli
Last updated by: fscholz,