This section defines a set of extensions to the interfaces defined in the Core section of the DOM Level 1 Recommendation to provide functionalities which are found to be essential but were not addressed in DOM Level 1.
These functionalitites include:
Document objectTwo new attributes are added to the DocumentType
interface to provide a way for retrieving the public and system
identifiers
interface DocumentType2 : DocumentType {
readonly attribute DOMString publicID;
readonly attribute DOMString systemID;
};
publicIDsystemIDThe DOMImplementation
interface is extended with methods for creating an XML document
instance.
interface DOMImplementation2 : DOMImplementation {
DocumentType createDocumentType(in DOMString name,
in DOMString publicID,
in DOMString systemID)
raises(DOMException);
Document createDocument(in DOMString name,
in DocumentType doctype)
raises(DOMException);
};
createDocumentTypeDocumentType node.
name |
The document type name. | |
publicID |
The document type public identifier. | |
systemID |
The document type system identifier. |
DocumentType node with
Node.ownerDocument set to
null.DOMExceptionNOT_SUPPORTED_ERR: Raised if the requested document type is not supported.
createDocumentDocument object of the
specified type with its document element.name |
The name of document element to be created. | |
doctype |
The type of document to be created or
When |
Document object.DOMExceptionWRONG_DOCUMENT_ERR: Raised if doctype has
already been used with a different document.
NOT_SUPPORTED_ERR: Raised if the requested document type is not supported.
The Document interface is extended
with a method for importing nodes from another
document.
interface Document2 : Document {
Node importNode(in Node importedNode,
in boolean deep);
};
importNodeparentNode is
null.).
For all nodes, importing a node creates a node object owned by
the importing document, with attribute values identical to the
source node's nodeName and nodeType, plus
the attributes related to namespaces (prefix and namespaces
URI). As in the Node.cloneNode() operation, the source
node is not altered.
Additional information is copied as appropriate to the
nodeType, attempting to mirror the behavior expected
if a fragment of XML or HTML source was copied from one document
to another, recognizing that the two documents may have different
DTDs in the XML case. The following list describes the specifics
for every type of node.
Attr
nodes are attached to the generated
Element. Default attributes are not
copied, though if the document being imported into defines
default attributes for this element name, those are
assigned. If importNode's "deep" option was set True, the
descendents of the the source element will be recursively
imported and the resulting nodes reassembled to form the
corresponding subtree.specified flag is set false
on the generated Attr. The descendents of the
the source Attr are recursively imported and
the resulting nodes reassembled to form the corresponding
subtree.Note that the deep parameter does not apply
to Attr nodes, they always carry their
children with them when imported.CharacterData copy their data and
length attributes from those of the source
node.EntityReference itself is copied,
even if a deep import was requested, since the
source and destination documents might have defined the
entity differently. If the document being imported into
provides a definition for this entity name, its value is
assigned.Entity nodes cannot be imported.target and
data values from those of the source node.Document nodes cannot be imported.DocumentType nodes cannot be imported.deep option was set
true, the descendents of the the source
element will be recursively imported and the resulting
nodes reassembled to form the corresponding
subtree. Otherwise, this simply generates an empty
DocumentFragment.Notation nodes cannot be imported.importedNode |
The node to import. | |
deep |
If |
Document.The Node interface is extended with an
additional method to test if it supports a specific
feature.
interface Node2 : Node {
boolean supports(in DOMString feature,
in DOMString version);
};
supportsfeature |
The package name of the feature to test. This is the
same name as what can be passed to the method
| |
version |
This is the version number of the package name to
test. In Level 2, version 1, this is the string "2.0".
If the version is not specified, supporting any version of
the feature will cause the method to return
|
true if this node defines a
subtree within which the specified feature is supported,
false otherwise.The Attr interface provides an
additional method for accessing the Element node
the attribute is attached to.
interface Attr2 : Attr {
readonly attribute Element ownerElement;
};
ownerElementElement node this attribute is
attached to or null if this attribute is not in
use.The HTMLDOMImplementation
interface extends the DOMImplementation
interface with a method for creating an HTML document
instance.
interface HTMLDOMImplementation : DOMImplementation {
HTMLDocument createHTMLDocument(in DOMString title);
};
createHTMLDocumentHTMLDocument object with
the minimal tree made of the following elements:
HTML, HEAD, TITLE, and
BODY.
title |
The title of the document to be set as the content of
the |
HTMLDocument object.