From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/document/implementation/index.html | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 files/zh-cn/web/api/document/implementation/index.html (limited to 'files/zh-cn/web/api/document/implementation/index.html') 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 +--- +
+ {{ApiRef}}
+

概要

+

返回一个和当前文档相关联的{{domxref("DOMImplementation")}}对象。

+

语法

+
DOMImpObj = document.implementation;
+
+

示例

+
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.
+
+

可以在一致性章节中查看可用的一系列DOM2级模型名称(例如:Core, HTML, XML等等)。

+

说明

+

W3C的DOM1级建议值规定了一种检测浏览器对某个DOM模型是否支持的方法——hasFeature方法(请参考上边的例子以及这篇文章 What does your user agent claim to support?)。如果它可用的话,那么DOMImplementation接口的其他方法就可以为操作文档以外的内容提供一些服务了。例如,DOMImplementation接口包含一个createDocumentType方法,它可以为实例管理的文档创建对应的DTD文档定义。

+

方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称动作返回值
{{domxref("DOMImplementation.createDocument","createDocument")}} (namespaceURI, qualifiedNameStr, {{domxref("DocumentType")}} ) {{domxref("document")}}
{{domxref("DOMImplementation.createDocumentType","createDocumentType")}} ( qualifiedNameStr, publicId, systemId ) {{domxref("DocumentType")}}
{{domxref("DOMImplementation.createHTMLDocument","createHTMLDocument")}} ( title ) {{domxref("document")}}
{{domxref("DOMImplementation.getFeature","getFeature")}} ( feature, version ) {{domxref("DOMObject")}}
{{domxref("DOMImplementation.hasFeature","hasFeature")}} ( feature, version ) {{domxref("Boolean")}}
+

规范

+ +

Gecko引擎的特别说明

+ -- cgit v1.2.3-54-g00ecf