aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/document/implementation/index.html
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/document/implementation/index.html
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/document/implementation/index.html')
-rw-r--r--files/zh-cn/web/api/document/implementation/index.html68
1 files changed, 68 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/document/implementation/index.html b/files/zh-cn/web/api/document/implementation/index.html
new file mode 100644
index 0000000000..473cf729a7
--- /dev/null
+++ b/files/zh-cn/web/api/document/implementation/index.html
@@ -0,0 +1,68 @@
+---
+title: document.implementation
+slug: Web/API/Document/implementation
+translation_of: Web/API/Document/implementation
+---
+<div>
+ {{ApiRef}}</div>
+<h2 id="概要">概要</h2>
+<p>返回一个和当前文档相关联的{{domxref("DOMImplementation")}}对象。</p>
+<h2 id="语法">语法</h2>
+<pre class="syntaxbox"><var>DOMImpObj</var> = document.implementation;
+</pre>
+<h2 id="示例">示例</h2>
+<pre class="brush: js">var modName = "HTML";
+var modVer = "2.0";
+var conformTest = document.implementation.hasFeature( modName, modVer );
+
+alert( "DOM " + modName + " " + modVer + " supported?: " + conformTest );
+
+// alerts with: "DOM HTML 2.0 supported?: true" if DOM Level 2 HTML module is supported.
+</pre>
+<p>可以在<a href="http://www.w3.org/TR/DOM-Level-2-Core/introduction.html#ID-Conformance-h2" style="line-height: 1.5;">一致性章节</a>中查看可用的一系列DOM2级模型名称<span style="line-height: 1.5;">(例如:Core, HTML, XML等等)。</span></p>
+<h2 id="说明">说明</h2>
+<p>W3C的DOM1级建议值规定了一种检测浏览器对某个DOM模型是否支持的方法——<code>hasFeature方法</code>(请参考上边的例子以及这篇文章 <a href="http://www.w3.org/2003/02/06-dom-support.html">What does your user agent claim to support?</a>)。如果它可用的话,那么<code>DOMImplementation接口的其他方法就可以为操作文档以外的内容提供一些服务了。例如,</code><code>DOMImplementation接口包含一个</code><code>createDocumentType方法,它可以为实例管理的文档创建对应的DTD文档定义。</code></p>
+<h2 id="方法">方法</h2>
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th>名称</th>
+ <th>动作</th>
+ <th>返回值</th>
+ </tr>
+ <tr>
+ <td>{{domxref("DOMImplementation.createDocument","createDocument")}} (<code>namespaceURI</code>, <code>qualifiedNameStr</code>, {{domxref("DocumentType")}} )</td>
+ <td> </td>
+ <td>{{domxref("document")}}</td>
+ </tr>
+ <tr>
+ <td>{{domxref("DOMImplementation.createDocumentType","createDocumentType")}} ( <code>qualifiedNameStr</code>, <code>publicId</code>, <code>systemId</code> )</td>
+ <td> </td>
+ <td>{{domxref("DocumentType")}}</td>
+ </tr>
+ <tr>
+ <td>{{domxref("DOMImplementation.createHTMLDocument","createHTMLDocument")}} ( <code>title</code> )</td>
+ <td> </td>
+ <td>{{domxref("document")}}</td>
+ </tr>
+ <tr>
+ <td>{{domxref("DOMImplementation.getFeature","getFeature")}} ( <code>feature</code>, <code>version</code> )</td>
+ <td> </td>
+ <td>{{domxref("DOMObject")}}</td>
+ </tr>
+ <tr>
+ <td>{{domxref("DOMImplementation.hasFeature","hasFeature")}} ( <code>feature</code>, <code>version</code> )</td>
+ <td> </td>
+ <td>{{domxref("Boolean")}}</td>
+ </tr>
+ </tbody>
+</table>
+<h2 id="规范">规范</h2>
+<ul>
+ <li><a href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490">DOM2级核心: implementation</a></li>
+ <li><a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490">DOM3级核心: implementation</a></li>
+</ul>
+<h2 id="Gecko引擎的特别说明">Gecko引擎的特别说明</h2>
+<ul>
+ <li>从Gecko 19.0 {{geckoRelease("19.0")}}开始{{domxref("DOMImplementation.hasFeature","hasFeature")}}方法总是返回true。</li>
+</ul>