Returns a DOMImplementation
object associated with the current document.
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.
A list of module names (e.g., Core, HTML, XML, etc) is available in the DOM Level 2 Conformance Section
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.
hasFeature
method will always return true.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/implementation