# DOMImplementation : Object
Return to: HTML DOM Level 2 index

Provides methods for performing operations that are DOM implementation independent.

## Platform Support

IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | ---
6.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

## Constructors

Constructor | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
DOMImplementation Constructor() : DOMImplementation Provides methods for performing operations that are DOM implementation independent. | Show Details | 6.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

### DOMImplementation() : DOMImplementation

Provides methods for performing operations that are DOM implementation independent.

Returns

DOMImplementation |

Visibility
  internal

## Functions

Method | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
static createCSSStyleSheet(String title, String media) : CSSStyleSheet Creates a new CSSStyleSheet object. | Show Details | 6.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

Parameters

String | title | Title of the CSS stylesheet.
String | media | Array of media types that the stylesheet applies to.

Returns

CSSStyleSheet |

Availability

  HTML DOM Level 2

static createDocument(String namespaceURI, String qualifiedName, [DocumentType doctype]) : Document Creates an XML document object. | Show Details | no | 1.0+ | 6.0+ | 8.0+ | 1.3+

- Opera: Supports the bare method only.
- Safari: Supports the bare method only.

Parameters

String | namespaceURI | Namespace URI to use for the root element for the document.
String | qualifiedName | Name to use for the root element of the document.
DocumentType | doctype | (optional)DocumentType object to use for this document.

Returns

Document |

  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. <method>createDocument</method> 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

static createDocumentType(String qualifiedName, String publicId, String systemId) : DocumentType Creates an empty DOCTYPE node for use in an XML document object | Show Details | 6.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

Parameters

String | qualifiedName | Qualified name for the document.
String | publicId | Unique public id for the external subset.
String | systemId | System id for the external subset.

Returns

DocumentType |

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. | Show Details | 6.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

Parameters

Object | title | Title of the document to be created.

Returns

HTMLDocument |

  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. | Show Details | 6.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

Parameters

String | feature | Name of the feature to be tested to see if it is supported.
String | version | (optional)Version number of the feature to be tested to see if it is supported.

Returns

Boolean |

  ### 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

## 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

text_javascript aptana_docs