Comment

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

Comment 接口代表标签(markup)之间的文本符号(textual notations)。尽管它通常不会显示出来,但是在查看源码时可以看到它们。在 HTML 和 XML 里,注释(Comments)为 '<!--' 和 '-->' 之间的内容。在 XML 里,注释中不能出现字符序列 '--'。

属性

该接口没有特定的属性,但是从其父类 CharacterData 继承属性,以及间接从 Node 继承部分属性。

构造函数

Comment() 实验性

使用文本内容作为参数,返回一个 Comment 对象。

方法

该接口没有特定的方法,但从其父类 CharacterData 继承方法,以及间接从 Node 继承部分方法。

规范

Specification
DOM
# interface-comment

浏览器兼容性

参见