{{DOMRef()}}
The Comment
interface represents textual notations within markup; although it is generally not displayed, it is still 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, {{domxref("CharacterData")}}, and indirectly those of {{domxref("Node")}}.
Constructor
- {{ domxref("Comment.Comment()", "Comment()") }} {{experimental_inline}}
-
Returns a
Comment
object with the parameter as its textual content.
Methods
This interface has no specific method, but inherits those of its parent, {{domxref("CharacterData")}}, and indirectly those of {{domxref("Node")}}.
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('DOM WHATWG', '#comment', 'Comment')}} | {{Spec2('DOM WHATWG')}} | Added the constructor. |
{{SpecName('DOM3 Core', 'core.html#ID-1728279322', 'Comment')}} | {{Spec2('DOM3 Core')}} | No change from {{SpecName('DOM2 Core')}} |
{{SpecName('DOM2 Core', 'core.html#ID-1728279322', 'Comment')}} | {{Spec2('DOM2 Core')}} | No change from {{SpecName('DOM1')}} |
{{SpecName('DOM1', 'level-one-core.html#ID-1728279322', 'Comment')}} | {{Spec2('DOM1')}} | Initial definition |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 | {{CompatGeckoDesktop("1.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Comment() constructor {{experimental_inline}} |
{{CompatUnknown}} | {{CompatGeckoDesktop("24.0")}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoMobile("1.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Comment() constructor {{experimental_inline}} |
{{CompatUnknown}} | {{CompatGeckoMobile("24.0")}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} |
See also