DOM
Comment() 构造函数返回一个新创建的 Comment 对象,其文本内容为可选参数中给出的字符串。
语法
new Comment()
new Comment(aString)
参数
aString
返回值
一个新的包含 aString(如果没有给出参数,则为空字符串)的注释(Comment)。
示例
let comment = new Comment("测试");
规范
浏览器兼容性
参见
- DOM 接口索引
- Document.createComment() 是此构造函数的一个过时替代方案。
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
