aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/comment
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/comment
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/comment')
-rw-r--r--files/zh-cn/web/api/comment/comment/index.html56
-rw-r--r--files/zh-cn/web/api/comment/index.html72
2 files changed, 128 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/comment/comment/index.html b/files/zh-cn/web/api/comment/comment/index.html
new file mode 100644
index 0000000000..4d6738ddc0
--- /dev/null
+++ b/files/zh-cn/web/api/comment/comment/index.html
@@ -0,0 +1,56 @@
+---
+title: Comment()
+slug: Web/API/Comment/Comment
+tags:
+ - API
+ - Comment
+ - Constructor
+ - DOM
+translation_of: Web/API/Comment/Comment
+---
+<p>{{ApiRef("DOM")}}{{seeCompatTable}}</p>
+
+<p>构造函数 <code><strong>Comment()</strong></code> 创建一个 {{domxref("Comment")}} 对象并返回,这个对象以可选的 {{domxref("DOMString")}} 参数作为它的文本内容。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>comment</em>1 = new Comment(); // Create an empty comment
+<code><em>comment2</em></code> = new Comment("This is a comment");
+</pre>
+
+<h2 id="示例">示例</h2>
+
+<pre class="brush: js language-js">var comment = new Comment("Test");</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">注释</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM WHATWG', '#dom-comment-comment', 'Comment: Comment')}}</td>
+ <td>{{Spec2('DOM WHATWG')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.Comment.Comment")}}</p>
+
+<div class="note">
+<p><strong>提示:</strong>对于不支持本构造函数的浏览器, {{domxref("Document.createComment()")}} 或许可以使用。</p>
+</div>
+
+<h2 id="相关文档">相关文档</h2>
+
+<ul>
+ <li><a href="/en-US/docs/DOM/DOM_Reference">The DOM interfaces index</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/comment/index.html b/files/zh-cn/web/api/comment/index.html
new file mode 100644
index 0000000000..bf95530d67
--- /dev/null
+++ b/files/zh-cn/web/api/comment/index.html
@@ -0,0 +1,72 @@
+---
+title: Comment
+slug: Web/API/Comment
+tags:
+ - API
+ - DOM
+ - 参考
+ - 注释
+translation_of: Web/API/Comment
+---
+<div>{{ ApiRef("DOM") }}</div>
+
+<p><span class="seoSummary"><code><strong>Comment</strong></code> 接口代表标签(markup)之间的文本符号(textual notations)。尽管它通常不会显示出来,但是在查看源码时可以看到它们。</span>在 HTML 和 XML 里,注释(Comments)为 '<code>&lt;!--</code>' 和 '<code>--&gt;</code>' 之间的内容。在 XML 里,注释中不能出现字符序列 '<code>--</code>'。</p>
+
+<h2 id="属性">属性</h2>
+
+<p><em>该接口没有特定的属性,但是从其父类 {{domxref("CharacterData")}} 继承属性,以及间接从 {{domxref("Node")}} 继承部分属性。</em></p>
+
+<h2 id="构造函数">构造函数</h2>
+
+<dl>
+ <dt>{{ domxref("Comment.Comment()", "Comment()") }} {{experimental_inline}}</dt>
+ <dd>使用文本内容作为参数,返回一个 <code>Comment</code> 对象。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<p>该接口没有特定的方法,但从其父类 {{domxref("CharacterData")}} 继承方法,以及间接从 {{domxref("Node")}} 继承部分方法。</p>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM WHATWG', '#comment', 'Comment')}}</td>
+ <td>{{Spec2('DOM WHATWG')}}</td>
+ <td>Added the constructor.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM3 Core', 'core.html#ID-1728279322', 'Comment')}}</td>
+ <td>{{Spec2('DOM3 Core')}}</td>
+ <td>No change from {{SpecName('DOM2 Core')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM2 Core', 'core.html#ID-1728279322', 'Comment')}}</td>
+ <td>{{Spec2('DOM2 Core')}}</td>
+ <td>No change from {{SpecName('DOM1')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM1', 'level-one-core.html#ID-1728279322', 'Comment')}}</td>
+ <td>{{Spec2('DOM1')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.Comment")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li><a href="/zh-CN/docs/Web/API/Document_Object_Model#DOM_%E6%8E%A5%E5%8F%A3">DOM 接口索引</a></li>
+</ul>