Web/API/Comment

From Get docs


The Comment interface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. Comments are represented in HTML and XML as content between '<!--' and '-->'. In XML, the character sequence '--' cannot be used within a comment.

Properties

This interface has no specific property, but inherits those of its parent, CharacterData, and indirectly those of Node.

Constructor

Comment() '
Returns a Comment object with the parameter as its textual content.

Methods

This interface has no specific method, but inherits those of its parent, CharacterData, and indirectly those of Node.

Specifications

Specification Status Comment
DOMThe definition of 'Comment' in that specification. Living Standard Added the constructor.
Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Comment' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Core Specification
Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Comment' in that specification. Obsolete No change from Document Object Model (DOM) Level 1 Specification
Document Object Model (DOM) Level 1 SpecificationThe definition of 'Comment' in that specification. Obsolete Initial definition

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
Comment Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support Yes

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

Comment() constructor

Experimental'

Chrome

Full support Yes

Edge

Full support ≤18

Firefox

Full support 24

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 24

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

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

Comment by Mozilla Contributors is licensed under CC-BY-SA 2.5.