Document.implementation - Web APIs 编辑

The Document.implementation property returns a DOMImplementation object associated with the current document.

Syntax

DOMImpObj = document.implementation;

Example

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.

A list of module names (e.g., Core, HTML, XML, etc.) is available in the DOM Level 2 Conformance Section.

Notes

The W3C's DOM Level 1 Recommendation only specified the hasFeature method, which is one way to determine if a DOM module is supported by a browser (see example above and What does your user agent claim to support?). If available, other DOMImplementation methods provide services for controlling things outside of a single document. For example, the DOMImplementation interface includes a createDocumentType method with which DTDs can be created for one or more documents managed by the implementation.

Specifications

SpecificationStatusComment
DOM
The definition of 'document.implementation' in that specification.
Living Standard

Browser compatibility

BCD tables only load in the browser

Gecko-specific notes

  • Starting with Gecko 19.0 (Firefox 19.0 / Thunderbird 19.0 / SeaMonkey 2.16) the hasFeature method will always return true.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:83 次

字数:2852

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文