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
Specification | Status | Comment |
---|---|---|
DOM The definition of 'document.implementation' in that specification. |
Living Standard |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
implementation | Chrome Full support 1 | Edge Full support 12 | Firefox Full support Yes | IE ? | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support Yes | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
Gecko-specific notes
- Starting with Gecko 19.0 (Firefox 19.0 / Thunderbird 19.0 / SeaMonkey 2.16) the
hasFeature
method will always return true.