DOMImplementation : Object

Provides methods for performing operations that are DOM implementation independent.

Browser/User Agent Support

IEMozillaNetscapeOperaSafariNetscapte
6.0+1.0+6.0+7.0+1.0+no

Constructors

ConstructorIEMozillaNetscapeOperaSafariNetscapte
Provides methods for performing operations that are DOM implementation independent.
6.0+1.0+6.0+7.0+1.0+no
 

Methods

MethodIEMozillaNetscapeOperaSafariNetscapte
Creates a new CSSStyleSheet object.
6.0+1.0+6.0+7.0+1.0+no
 
Creates an XML document object.
no1.0+6.0+8.0+1.3+no
  • Opera: Supports the bare method only.
  • Safari: Supports the bare method only.
Creates an empty DOCTYPE node for use in an XML document object
6.0+1.0+6.0+7.0+1.0+no
 
Creates a blank HTML document that contains properly nested html, head, title, and body tags.
6.0+1.0+6.0+7.0+1.0+no
 
Tests a feature to see if the current DOM implementation supports the feature/version.
6.0+1.0+6.0+7.0+1.0+no
 

Remarks

This object defines methods for performing operations that are independant of any particular instance of the DOM. It is equivilant to the Global object in ECMA-262.This permits a user to, for instance, create new documents, or determine if the DOM implementation supports some given feature. These are methods that do not belong in any DOM instance-related objects.

Availability

HTML DOM Level 2 | W3C

Constructor Detail

DOMImplementation DOMImplementation()

Provides methods for performing operations that are DOM implementation independent.

Visibility
internal

Method Detail

createCSSStyleSheet(String title, String media) : static CSSStyleSheet

Creates a new CSSStyleSheet object.

StringtitleTitle of the CSS stylesheet.
StringmediaArray of media types that the stylesheet applies to.

Availability

HTML DOM Level 2

createDocument(String namespaceURI, String qualifiedName, [DocumentType doctype]) : static Document

Creates an XML document object.

StringnamespaceURINamespace URI to use for the root element for the document.
StringqualifiedNameName to use for the root element of the document.
DocumentTypedoctypeDocumentType object to use for this document. (optional)

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/implementation.html

Remarks
Creates a new document, which can subsequently be used to add new nodes and other content. createDocument takes arguments defining what the name of the document (or root) element will be. Additionally it can take an optional DocumentType object that can be used to define a logical <!DOCTYPE> block for this document.
Throws
Raises an INVALID_CHARACTER_ERR error if the specified target contains illegal characers.
Raises a NAMESPACE_ERR error if qualifiedName is incorrectly formed, has a namespace prefix or is set to xml when the namespaceURI is not "http://www.w3.org/XML/1998/namespace".
Raises a WRONG_DOCUMENT_ERR error if the supplied doctype has already been used by a different document.
See Also

DOMImplementation.createDocumentType | DOMImplementation.createHTMLDocument

Availability

HTML DOM Level 2 | W3C

createDocumentType(String qualifiedName, String publicId, String systemId) : static DocumentType

Creates an empty DOCTYPE node for use in an XML document object

StringqualifiedNameQualified name for the document.
StringpublicIdUnique public id for the external subset.
StringsystemIdSystem id for the external subset.

Remarks
Creates a new, blank, document type object, representing what would normally be serialized in XML as the DOCTYPE element so that you can declare entities and notations that are not a part of the content of the document.
Throws
Raises INVALID_CHARACTER_ERR error if qualifiedName contains illegal characers.
Raises NAMESPACE_ERR error if qualifiedName is malformed.
Availability

HTML DOM Level 2 | W3C

createHTMLDocument(Object title) : HTMLDocument

Creates a blank HTML document that contains properly nested html, head, title, and body tags.

ObjecttitleTitle of the document to be created.

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/implementation.html

See Also

DOMImplementation.createDocument

Availability

HTML DOM Level 2

hasFeature(String feature, [String version]) : Boolean

Tests a feature to see if the current DOM implementation supports the feature/version.

StringfeatureName of the feature to be tested to see if it is supported.
StringversionVersion number of the feature to be tested to see if it is supported. (optional)

Using hasFeature

if (document.implementation.hasFeature("DOM", "2.0")) {
                    // Magic happens here
                    } else {
                    // Exit out...
                    }
Remarks
Use this method to test if the current DOM implementation supports a required feature of your software.
See Also

Node.isSupported

Availability

HTML DOM Level 2 | W3C