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.

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

属性

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

构造函数

Comment() 实验性

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

方法

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

规范

Specification
DOM
# interface-comment

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Comment
Comment() constructor

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

参见