Packagedom.core
Classpublic class Document
InheritanceDocument Inheritance Node Inheritance Object
Implements DocumentCSS, DocumentStyle, DocumentView, DocumentView, DocumentRange, DocumentEvent, DocumentTraversal, NodeSelector, DOMImplementationLS, DocumentLS
Subclasses HTMLDocument

Introduced in: DOM 0 
Modified in: DOM 3 Core 

In the DOM, the document object provides a general way to represent HTML, XHTML, and XML documents. Document objects implement the general DOM Core document interface (which itself implements the Node interface).

In addition to the generalized DOM Core document interface, HTML documents also implement the DOM HTMLDocument interface, which is a more specialized interface for dealing with HTML documents (e.g., document.cookie, document.alinkColor). Methods listed here that are part of this more specialized interface have an asterisk (*) next to them.

The document is contained by the window object and may contain any number of elements.

The document interface provides access to things such as the document type, its color and formatting, plugins and applets, as well providing methods for creating and manipulating all of the document's child nodes, or elements, such as BODY and TABLE elements.

See also

MSDN - document Object
MDC - Document
W3C - Document


Public Properties
 PropertyDefined By
  DOM 3 Load and Save Obsolete async : Boolean
Indicates whether the method load should be synchronous or asynchronous.
Document
 InheritedDOM 1 Core attributes : NamedNodeMap
[read-only] Returns an unordered collection of Attr nodes.
Node
 InheritedNon-Standard baseName : DOMString
[read-only] Returns the base name for the name qualified with the namespace.
Node
 InheritedDOM 3 Core baseURI : DOMString
[read-only] The absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.
Node
 InheritedDOM 1 Core childNodes : NodeList
[read-only] Returns an ordered collection of node objects that are children of the current element.
Node
 InheritedNon-Standard dataType : *
Specifies the data type for this node.
Node
  DOM 2 Views defaultView : AbstractView
[read-only] The default AbstractView for this Document, or null if none available.
Document
 InheritedNon-Standard definition : Node
[read-only] Returns the definition of the node in the document type definition (DTD) or schema.
Node
  DOM 1 Core doctype : DocumentType
[read-only] The Document Type Declaration (see DocumentType) associated with this document.
Document
  DOM 1 Core documentElement : Element
[read-only] This is a convenience attribute that allows direct access to the child node that is the document element of the document.
Document
  DOM 3 Core documentURI : DOMString
The location of the document or null if undefined or if the Document was created using DOMImplementation.createDocument.
Document
  DOM 3 Core domConfig : DOMConfiguration
[read-only] The configuration used when Document.normalizeDocument() is invoked.
Document
 InheritedDOM 1 Core firstChild : Node
[read-only] Returns the node's first child in the tree, or null if the node is childless.
Node
  DOM 1 Core implementation : DOMImplementation
[read-only] The DOMImplementation object that handles this document.
Document
  DOM 3 Core inputEncoding : DOMString
[read-only] Returns a string representing the encoding under which the document was parsed (e.g.
Document
 InheritedDOM 1 Core lastChild : Node
[read-only] Returns the last child of a node.
Node
  CSSOM lastStyleSheetSet : DOMString
[read-only] This attribute must initially have the value null.
Document
 InheritedDOM 2 Core localName : DOMString
[read-only] Returns the local part of the qualified name of this node.
Node
 InheritedDOM 2 Core namespaceURI : DOMString
[read-only] The namespace URI of the node, or null if it is unspecified (read-only).
Node
 InheritedDOM 1 Core nextSibling : Node
[read-only] Returns the node immediately following the specified one in its parent's childNodes list, or null if the specified node is the last node in that list.
Node
 InheritedDOM 1 Core nodeName : DOMString
[read-only] Returns the name of the current node as a string.
Node
 InheritedNon-Standard nodePrincipal : nsIPrincipal
[read-only] Returns the nsIPrincipal object representing current security context of the node.
Node
 InheritedDOM 1 Core nodeType : Number
[read-only] Returns an integer code representing the type of the node.
Node
 InheritedNon-Standard nodeTypedValue : *
Contains the node value expressed in its defined data type.
Node
 InheritedNon-Standard nodeTypeString : DOMString
[read-only] Returns the node type in string form.
Node
 InheritedDOM 1 Core nodeValue : DOMString
Returns or sets the value of the current node.
Node
 InheritedDOM 1 Core ownerDocument : Document
[read-only] The Document object associated with this node.
Node
 InheritedDOM 1 Core parentNode : Node
[read-only] Returns the parent of the specified node in the DOM tree.
Node
 InheritedNon-Standard parsed : Boolean
[read-only] Indicates the parsed status of the node and child nodes.
Node
  CSSOM preferredStyleSheetSet : DOMString
[read-only] This attribute must be the preferred style sheet set as set by the author.
Document
 InheritedDOM 2 Core prefix : DOMString
Returns the namespace prefix of the specified node, or null if no prefix is specified.
Node
 InheritedDOM 1 Core previousSibling : Node
[read-only] Returns the node immediately preceding the specified one in its parent's childNodes list, null if the specified node is the first in that list.
Node
  CSSOM selectedStyleSheetSet : DOMString
This attribute indicates which style sheet set is in use.
Document
 InheritedNon-Standard specified : Boolean
[read-only] Indicates whether the node (usually an attribute) is explicitly specified or derived from a default value in the document type definition (DTD) or schema.
Node
  DOM 3 Core strictErrorChecking : Boolean
An attribute specifying whether error checking is enforced or not.
Document
  DOM 2 Style styleSheets : StyleSheetList
[read-only] A list containing all the style sheets explicitly linked into or embedded in a document.
Document
  CSSOM styleSheetSets : DOMStringList
[read-only] This must be a live list of the currently available style sheet sets.
Document
 InheritedNon-Standard text : DOMString
Represents the text content of the node or the concatenated text representing the node and its descendants.
Node
 InheritedDOM 3 Core textContent : DOMString
Gets or sets the text content of a node and its descendants.
Node
 InheritedNon-Standard xml : DOMString
[read-only] Contains the XML representation of the node and all its descendants.
Node
  DOM 3 Core xmlEncoding : DOMString
[read-only] An attribute specifying, as part of the XML declaration, the encoding of this document.
Document
  DOM 3 Core xmlStandalone : Boolean
An attribute specifying, as part of the XML declaration, whether this document is standalone.
Document
  DOM 3 Core xmlVersion : DOMString
An attribute specifying, as part of the XML declaration, the version number of this document.
Document
Public Methods
 MethodDefined By
  
DOM 3 Load and Save Obsolete abort():void
If the document is currently being loaded as a result of the method load being invoked the loading and parsing is immediately aborted.
Document
 Inherited
DOM 2 Events addEventListener(type:DOMString, listener:EventListener, useCapture:Boolean):void
Associates a function with a particular event and binds the event to the current node.
Node
 Inherited
DOM 3 Events addEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):void
Registers an event listener, depending on the useCapture parameter, on the capture phase of the DOM event flow or its target and bubbling phases.
Node
  
DOM 3 Core adoptNode(source:Node):Node
Attempts to adopt a node from another document to this document.
Document
 Inherited
DOM 1 Core appendChild(element:Node):Node
Adds a node to the end of the list of children of a specified parent node.
Node
  
Non-Standard attachEvent(type:DOMString, listener:Function):Boolean
Binds the specified function to an event, so that the function gets called whenever the event fires on the object.
Document
  
DOM 3 Events canDispatch(namespaceURI:DOMString, type:DOMString):Boolean
Tests if the implementation can generate events of a specified type.
Document
 Inherited
DOM 1 Core cloneNode(cloneChildren:Boolean):Node
Returns a duplicate of the current node.
Node
 Inherited
DOM 3 Core compareDocumentPosition(other:Node):Number
Compares the position of the current node against another node in any other document.
Node
  
DOM 1 Core createAttribute(name:DOMString):Attr
Creates an Attr of the given name.
Document
  
DOM 2 Core createAttributeNS(namespaceURI:DOMString, qualifiedName:DOMString):Attr
Creates an attribute of the given qualified name and namespace URI.
Document
  
Creates a CDATASection node whose value is the specified string.
Document
  
DOM 1 Core createComment(data:DOMString):Comment
Creates a Comment node given the specified string.
Document
  
Creates an empty DocumentFragment object.
Document
  
DOM 1 Core createElement(tagName:DOMString):Element
Creates an element of the type specified.
Document
  
DOM 2 Core createElementNS(namespaceURI:DOMString, qualifiedName:DOMString):Element
Creates an element of the given qualified name and namespace URI.
Document
  
Creates an EntityReference object.
Document
  
DOM 2 Events createEvent(eventType:DOMString):Event
Creates an event object of the type specified.
Document
  
Non-Standard createEventObject(existingEvent:Event = null):Event
Generates an event object to pass event context information when you use the fireEvent method.
Document
  
DOM 3 Load and Save createLSInput():LSInput
Create a new empty input source object where LSInput.characterStream, LSInput.byteStream, LSInput.stringData LSInput.systemId, LSInput.publicId, LSInput.baseURI, and LSInput.encoding are null, and LSInput.certifiedText is false.
Document
  
DOM 3 Load and Save createLSOutput():LSOutput
Create a new empty output destination object where LSOutput.characterStream, LSOutput.byteStream, LSOutput.systemId, LSOutput.encoding are null.
Document
  
DOM 3 Load and Save createLSParser(mode:Number, schemaType:DOMString):LSParser
Create a new LSParser.
Document
  
DOM 3 Load and Save createLSSerializer():LSSerializer
Create a new LSSerializer object.
Document
  
DOM 2 TR createNodeIterator(root:Node, whatToShow:Number, filter:NodeFilter, entityReferenceExpansion:Boolean):NodeIterator
Create a new NodeIterator over the subtree rooted at the specified node.
Document
  
Creates a ProcessingInstruction node given the specified name and data strings.
Document
  
DOM 2 TR createRange():Range
This interface can be obtained from the object implementing the Document interface using binding-specific casting methods.
Document
  
Non-Standard createStyleSheet(url:DOMString = null, index:Number):StyleSheet
Creates a style sheet for the document.
Document
  
DOM 1 Core createTextNode(data:DOMString):Text
Creates a Text node given the specified string.
Document
  
DOM 2 TR createTreeWalker(root:Node, whatToShow:Number, filter:NodeFilter, entityReferenceExpansion:Boolean):TreeWalker
Create a new TreeWalker over the subtree rooted at the specified node.
Document
  
Non-Standard detachEvent(type:DOMString, listener:Function):void
Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.
Document
 Inherited
DOM 2 Events dispatchEvent(evt:Event):Boolean
Dispatches an event to fire on a node artificially.
Node
  
CSSOM View elementFromPoint(x:Number, y:Number):Element
Returns the element from the document whose elementFromPoint method is being called which is the topmost element which lies under the given point.
Document
  
Invoking this method must change the disabled attribute on each StyleSheet object with a title in the styleSheets attribute, so that all those whose title matches the name argument are enabled, and all others are disabled.
Document
  
Returns a NodeList of all the Elements in document order with a given tag name and are contained in the document.
Document
  
DOM 2 Core getElementsByTagNameNS(namespaceURI:DOMString, localName:DOMString):NodeList
Returns a NodeList of all the Elements with a given local name and namespace URI in document order.
Document
  
DOM 1 HTML getElemenyById(elementId:DOMString):Element
Returns the Element that has an ID attribute with the given value.
Document
 Inherited
DOM 3 Core getFeature(feature:DOMString, version:DOMString):DOMObject
This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in DOM Features.
Node
  
This method is used to retrieve the override style declaration for a specified element and a specified pseudo-element.
Document
 Inherited
Retrieves the object associated to a key on a this node.
Node
 Inherited
DOM 2 Core hasAttributes():Boolean
Returns a boolean value of true or false, indicating if the current element has any attributes or not.
Node
 Inherited
DOM 1 Core hasChildNodes():Boolean
Returns a value that indicates whether the object has children.
Node
  
DOM 2 Core importNode(importedNode:Node, deep:Boolean):Node
Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node.
Document
 Inherited
DOM 1 Core insertBefore(newNode:Node, childNode:Node):Node
Inserts the specified node before a reference element as a child of the current node.
Node
 Inherited
DOM 3 Core isDefaultNamespace(namespaceURI:DOMString):Boolean
Returns true if the namespace is the default namespace on the given node or false if not.
Node
 Inherited
DOM 3 Core isEqualNode(arg:Node):Boolean
Tests whether two nodes are equal.
Node
 Inherited
DOM 3 Core isSameNode(other:Node):Boolean
Returns whether this node is the same node as the given one.
Node
 Inherited
DOM 2 Core isSupported(feature:DOMString, version:DOMString):Boolean
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
Node
  
DOM 3 Load and Save Obsolete load(uri:DOMString):Boolean
Replaces the content of the document with the result of parsing the given URI.
Document
  
DOM 3 Load and Save Obsolete loadXML(source:DOMString):Boolean
Replace the content of the document with the result of parsing the input string, this method is always synchronous.
Document
 Inherited
Takes a prefix and returns the namespaceURI associated with it on the given node if found (and null if not).
Node
 Inherited
DOM 3 Core lookupPrefix(namespaceURI:DOMString):DOMString
Returns the prefix for a given namespaceURI if present, and null if not.
Node
 Inherited
DOM 1 Core normalize():void
Puts the specified node and all of its subtree into a "normalized" form.
Node
  
DOM 3 Core normalizeDocument():void
This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form.
Document
  
Selectors API querySelector(selectors:DOMString):Element
Returns the first element that is a descendent of the element on which it is invoked that matches the specified group of selectors.
Document
  
Selectors API querySelectorAll(selectors:DOMString):NodeList
Returns a list of all elements descended from the element on which it is invoked that match the specified group of selectors.
Document
 Inherited
DOM 1 Core removeChild(node:Node):Node
Removes a child node from the object.
Node
 Inherited
DOM 2 Events removeEventListener(type:DOMString, listener:EventListener, useCapture:Boolean):void
Removes an event listener.
Node
 Inherited
DOM 3 Events removeEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):void
Removes an event listener.
Node
  
DOM 3 Core renameNode(n:Node, namespaceURI:DOMString, qualifiedName:DOMString):Node
Rename an existing node of type ELEMENT_NODE or ATTRIBUTE_NODE.
Document
 Inherited
DOM 1 Core replaceChild(newNode:Node, childNode:Node):Node
Replaces an existing child element with a new child element.
Node
  
DOM 3 Load and Save Obsolete saveXML(snode:Node):DOMString
Save the document or the given node to a string (i.e.
Document
 Inherited
Non-Standard selectNodes(queryString:DOMString):NodeList
Applies the specified pattern-matching operation to this node's context and returns the list of matching nodes as IXMLDOMNodeList.
Node
 Inherited
Non-Standard selectSingleNode(queryString:DOMString):Node
Applies the specified pattern-matching operation to this node's context and returns the first matching node.
Node
 Inherited
Associate an object to a key on this node.
Node
 Inherited
Non-Standard transformNode(styleSheet:Node):DOMString
Processes this node and its children using the supplied Extensible Stylesheet Language Transformations (XSLT) style sheet and returns the resulting transformation.
Node
 Inherited
Non-Standard transformNodeToObject(styleSheet:Node, outputObject:*):void
Processes this node and its children using the supplied Extensible Stylesheet Language Transformations (XSLT) style sheet and returns the resulting transformation.
Node
  
Non-Standard updateSettings():void
Allows updating the print settings for the page.
Document
Events
 Event Summary Defined By
  This is a general event for notification of all changes to the document.Document
  The DOM Implementation finishes loading the resource (such as the document) and any dependent resources (such as images, style sheets, or scripts).Document
  A mouse wheel has been rotated.Document
  A mouse wheel has been rotated around the y-axis.Document
  Is fired when the browser switches between online and offline mode.Document
  Is fired when the browser switches between online and offline mode.Document
  A document view or an element has been resized.Document
  A document view or an element has been scrolled.Document
  The DOM implementation removes from the environment the resource (such as the document) or any dependent resources (such as images, style sheets, scripts).Document
Public Constants
 ConstantDefined By
 InheritedDOM 1 Core ATTRIBUTE_NODE : Number = 2
[static] The node is an Attr.
Node
 InheritedDOM 1 Core CDATA_SECTION_NODE : Number = 4
[static] The node is a CDATASection.
Node
 InheritedDOM 1 Core COMMENT_NODE : Number = 8
[static] The node is a Comment.
Node
 InheritedDOM 1 Core DOCUMENT_FRAGMENT_NODE : Number = 11
[static] The node is a DocumentFragment.
Node
 InheritedDOM 1 Core DOCUMENT_NODE : Number = 9
[static] The node is a Document.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_CONTAINED_BY : Number = 16
[static] The node is contained by the reference node.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_CONTAINS : Number = 8
[static] The node contains the reference node.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_DISCONNECTED : Number = 1
[static] The two nodes are disconnected.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_FOLLOWING : Number = 4
[static] The node follows the reference node.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : Number = 32
[static] The determination of preceding versus following is implementation-specific.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_PRECEDING : Number = 2
[static] The second node precedes the reference node.
Node
 InheritedDOM 1 Core DOCUMENT_TYPE_NODE : Number = 10
[static] The node is a DocumentType.
Node
 InheritedDOM 1 Core ELEMENT_NODE : Number = 1
[static] The node is an Element.
Node
 InheritedDOM 1 Core ENTITY_NODE : Number = 6
[static] The node is an Entity.
Node
 InheritedDOM 1 Core ENTITY_REFERENCE_NODE : Number = 5
[static] The node is an EntityReference.
Node
 InheritedDOM 1 Core NOTATION_NODE : Number = 12
[static] The node is a Notation.
Node
 InheritedDOM 1 Core PROCESSING_INSTRUCTION_NODE : Number = 7
[static] The node is a ProcessingInstruction.
Node
 InheritedDOM 1 Core TEXT_NODE : Number = 3
[static] The node is a Text node.
Node
Property Detail
DOM 3 Load and Save Obsolete asyncproperty
async:Boolean

Obsolete

Indicates whether the method load should be synchronous or asynchronous. When the async attribute is set to true the load method returns control to the caller before the document has completed loading.


Implementation
    public function get async():Boolean
    public function set async(value:Boolean):void

See also


Example
         function loadXMLData(e) {
             alert(new XMLSerializer().serializeToString(e.target)); // Gives querydata.xml contents as string
         }
         
         var xmlDoc = document.implementation.createDocument("", "test", null);
         xmlDoc.async = false;
         xmlDoc.onload = loadXMLData;
         xmlDoc.load('querydata.xml');
DOM 2 Views defaultViewproperty 
defaultView:AbstractView  [read-only]

Introduced in: DOM 2 Core 

The default AbstractView for this Document, or null if none available.

Note: document.defaultView is generally a reference to the window object for the document, however that is not defined in the specification and can't be relied upon for all host environments, particularly as not all browsers implement it.


Implementation
    public function get defaultView():AbstractView

See also

DOM 1 Core doctypeproperty 
doctype:DocumentType  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 1 Core 
Modified in: DOM 3 Core 

The Document Type Declaration (see DocumentType) associated with this document. For XML documents without a document type declaration this returns null. For HTML documents, a DocumentType object may be returned, independently of the presence or absence of document type declaration in the HTML document.

This provides direct access to the DocumentType node, child node of this Document. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such as Node.insertBefore, or Node.replaceChild. Note, however, that while some implementations may instantiate different types of Document objects supporting additional features than the "Core", such as "HTML", based on the DocumentType specified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.


Implementation
    public function get doctype():DocumentType

See also

DOM 1 Core documentElementproperty 
documentElement:Element  [read-only]

Introduced in: DOM 1 Core 

This is a convenience attribute that allows direct access to the child node that is the document element of the document.

Note: HTML documents typically contain a single child node, <html>, perhaps with a DOCTYPE declaration before it. XML documents often contain multiple child nodes: the root element, the DOCTYPE declaration, and processing instructions.

That's why you should use document.documentElement rather than document.firstChild to get the root element.


Implementation
    public function get documentElement():Element

See also


Example
         var rootElement = document.documentElement;
         var firstTier = rootElement.childNodes;
         // firstTier is the NodeList of the direct children of the root element
         for (var i = 0; i < firstTier.length; i++) {
             // do something with each direct kid of the root element
             // as firstTier[i]
         }
DOM 3 Core documentURIproperty 
documentURI:DOMString

Introduced in: DOM 3 Core 

The location of the document or null if undefined or if the Document was created using DOMImplementation.createDocument. No lexical checking is performed when setting this attribute; this could result in a null value returned when using Node.baseURI.

Beware that when the Document supports the feature "HTML", the href attribute of the HTML BASE element takes precedence over this attribute when computing Node.baseURI.


Implementation
    public function get documentURI():DOMString
    public function set documentURI(value:DOMString):void

See also

DOM 3 Core domConfigproperty 
domConfig:DOMConfiguration  [read-only]

Introduced in: DOM 3 Core 

The configuration used when Document.normalizeDocument() is invoked.

Note (Mozilla): This is not implemented in Mozilla at present.


Implementation
    public function get domConfig():DOMConfiguration

See also

DOM 1 Core implementationproperty 
implementation:DOMImplementation  [read-only]

Introduced in: DOM 1 Core 

The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.


Implementation
    public function get implementation():DOMImplementation

See also


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

DOM 3 Core inputEncodingproperty 
inputEncoding:DOMString  [read-only]

Introduced in: DOM 3 Core 

Returns a string representing the encoding under which the document was parsed (e.g. ISO-8859-1). This is null when it is not known, such as when the Document was created in memory.


Implementation
    public function get inputEncoding():DOMString

See also

CSSOM lastStyleSheetSetproperty 
lastStyleSheetSet:DOMString  [read-only]

Introduced in: CSSOM 

This attribute must initially have the value null. Its value changes when the selectedStyleSheetSet attribute is set.


Implementation
    public function get lastStyleSheetSet():DOMString

See also

CSSOM preferredStyleSheetSetproperty 
preferredStyleSheetSet:DOMString  [read-only]

Introduced in: CSSOM 

This attribute must be the preferred style sheet set as set by the author. It is determined from the order of style sheet declarations and the Default-Style HTTP headers. If there is no preferred style sheet set, this attribute must be the empty string. The case of this attribute must exactly match the case given by the author where the preferred style sheet is specified or implied. This attribute must never be null.


Implementation
    public function get preferredStyleSheetSet():DOMString

See also

CSSOM selectedStyleSheetSetproperty 
selectedStyleSheetSet:DOMString

Introduced in: CSSOM 

This attribute indicates which style sheet set is in use. This attribute is live; changing the disabled attribute on style sheets directly will change the value of this attribute.

If all the sheets that are enabled and have a title have the same title (by case-sensitive comparisons) then the value of this attribute must be exactly equal to the title of the first enabled style sheet with a title in the styleSheets list. Otherwise, if style sheets from different sets are enabled, then the return value must be null (there is no way to determine what the currently selected style sheet set is in those conditions). Otherwise, either all style sheets that have a title are disabled, or there are no alternative style sheets, and selectedStyleSheetSet must return the empty string.


Implementation
    public function get selectedStyleSheetSet():DOMString
    public function set selectedStyleSheetSet(value:DOMString):void

See also

DOM 3 Core strictErrorCheckingproperty 
strictErrorChecking:Boolean

Introduced in: DOM 3 Core 

An attribute specifying whether error checking is enforced or not. When set to false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any DOMException on DOM operations or report errors while using Document.normalizeDocument(). In case of error, the behavior is undefined. This attribute is true by default.

The default value is true.


Implementation
    public function get strictErrorChecking():Boolean
    public function set strictErrorChecking(value:Boolean):void

See also

DOM 2 Style styleSheetsproperty 
styleSheets:StyleSheetList  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 2 Core 

A list containing all the style sheets explicitly linked into or embedded in a document. For HTML documents, this includes external style sheets, included via the HTML LINK element, and inline STYLE elements. In XML, this includes external style sheets, included via style sheet processing instructions.


Implementation
    public function get styleSheets():StyleSheetList

See also

CSSOM styleSheetSetsproperty 
styleSheetSets:DOMStringList  [read-only]

Introduced in: CSSOM 

This must be a live list of the currently available style sheet sets. This list is constructed by enumerating all the style sheets for this document available to the implementation, in the order they are listed in the styleSheets attribute, adding the title of each style sheet with a title to the list, avoiding duplicates by dropping titles that match (case-sensitively) titles that have already been added to the list.


Implementation
    public function get styleSheetSets():DOMStringList

See also

MDC - Document.styleSheetSets
W3C - DocumentStyle.styleSheetSets
DOM 3 Core xmlEncodingproperty 
xmlEncoding:DOMString  [read-only]

Introduced in: DOM 3 Core 

An attribute specifying, as part of the XML declaration, the encoding of this document. This is null when unspecified or when it is not known, such as when the Document was created in memory.

If the XML Declaration states:

<?xml version="1.0" encoding="UTF-16"?>

...the result should be "UTF-16".

Note (Mozilla): However, Firefox 3.0 includes information on endianness (e.g., UTF-16BE for big endian encoding), and while this extra information is removed as of Firefox 3.1b3, Firefox 3.1b3 is still consulting the file's encoding, rather than the XML Declaration as the spec defines it ("An attribute specifying, as part of the XML declaration, the encoding of this document.").


Implementation
    public function get xmlEncoding():DOMString

See also

DOM 3 Core xmlStandaloneproperty 
xmlStandalone:Boolean

Introduced in: DOM 3 Core 

An attribute specifying, as part of the XML declaration, whether this document is standalone. This is false when unspecified.

Note: No verification is done on the value when setting this attribute. Applications should use Document.normalizeDocument() with the "validate" parameter to verify if the value matches the validity constraint for standalone document declaration as defined in XML 1.0.


Implementation
    public function get xmlStandalone():Boolean
    public function set xmlStandalone(value:Boolean):void

Throws
DOMException — NOT_SUPPORTED_ERR: Raised if this document does not support the "XML" feature.

See also

DOM 3 Core xmlVersionproperty 
xmlVersion:DOMString

Introduced in: DOM 3 Core 

An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if this document supports the "XML" feature, the value is "1.0". If this document does not support the "XML" feature, the value is always null. Changing this attribute will affect methods that check for invalid characters in XML names. Application should invoke Document.normalizeDocument() in order to check for invalid characters in the Nodes that are already part of this Document.

DOM applications may use the DOMImplementation.hasFeature(feature, version) method with parameter values "XMLVersion" and "1.0" (respectively) to determine if an implementation supports XML 1.0. DOM applications may use the same method with parameter values "XMLVersion" and "1.1" (respectively) to determine if an implementation supports XML 1.1. In both cases, in order to support XML, an implementation must also support the "XML" feature defined in this specification. Document objects supporting a version of the "XMLVersion" feature must not raise a NOT_SUPPORTED_ERR exception for the same version number when using Document.xmlVersion.


Implementation
    public function get xmlVersion():DOMString
    public function set xmlVersion(value:DOMString):void

Throws
DOMException — NOT_SUPPORTED_ERR: Raised if the version is set to a value that is not supported by this Document or if this document does not support the "XML" feature.

See also

Method Detail
DOM 3 Load and Save Obsolete abort()method
public function abort():void

Obsolete

If the document is currently being loaded as a result of the method load being invoked the loading and parsing is immediately aborted. The possibly partial result of parsing the document is discarded and the document is cleared.

See also

DOM 3 Core adoptNode()method 
public function adoptNode(source:Node):Node

Introduced in: DOM 3 Core 

Attempts to adopt a node from another document to this document. If supported, it changes the ownerDocument of the source node, its children, as well as the attached attribute nodes if there are any. If the source node has a parent it is first removed from the child list of its parent. This effectively allows moving a subtree from one document to another (unlike importNode() which create a copy of the source node instead of moving it). When it fails, applications should use Document.importNode() instead. Note that if the adopted node is already part of this document (i.e. the source and target document are the same), this method still has the effect of removing the source node from the child list of its parent, if any. The following list describes the specifics for each type of node.

AttributeValue
ATTRIBUTE_NODEThe ownerElement attribute is set to null and the specified flag is set to true on the adopted Attr. The descendants of the source Attr are recursively adopted.
DOCUMENT_FRAGMENT_NODEThe descendants of the source node are recursively adopted.
DOCUMENT_NODEDocument nodes cannot be adopted.
DOCUMENT_TYPE_NODEDocumentType nodes cannot be adopted.
ELEMENT_NODESpecified attribute nodes of the source element are adopted. Default attributes are discarded, though if the document being adopted into defines default attributes for this element name, those are assigned. The descendants of the source element are recursively adopted.
ENTITY_NODEEntity nodes cannot be adopted.
ENTITY_REFERENCE_NODEOnly the EntityReference node itself is adopted, the descendants are discarded, 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.
NOTATION_NODENotation nodes cannot be adopted.
PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODEThese nodes can all be adopted. No specifics.

Note: Since it does not create new nodes unlike the Document.importNode() method, this method does not raise an INVALID_CHARACTER_ERR exception, and applications should use the Document.normalizeDocument() method to check if an imported name is not an XML name according to the XML version in use.

Parameters

source:Node — The node to move into this document.

Returns
Node — The adopted node, or null if this operation fails, such as when the source node comes from a different implementation.

Throws
DOMException — NOT_SUPPORTED_ERR: Raised if the source node is of type DOCUMENT, DOCUMENT_TYPE.
 
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is readonly.

See also

attachEvent()method 
public function attachEvent(type:DOMString, listener:Function):Boolean

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a

Non-standard (Microsoft)

Binds the specified function to an event, so that the function gets called whenever the event fires on the object.

Parameters

type:DOMString — The event string should include the "on" prefix (ie: "onload", "onclick" etc).
 
listener:Function — The function or method to associate with the event.

Returns
Boolean — true (successful) or false (failed).

See also


Example
if (window.attachEvent) window.attachEvent("onload", statusreport); //invoke function
DOM 3 Events canDispatch()method 
public function canDispatch(namespaceURI:DOMString, type:DOMString):Boolean

Introduced in: DOM 3 Events 

Tests if the implementation can generate events of a specified type.

Parameters

namespaceURI:DOMString — Specifies the Event.namespaceURI of the event.
 
type:DOMString — Specifies the Event.type of the event.

Returns
Boolean — If the implementation can generate and dispatch this event type

See also

DOM 1 Core createAttribute()method 
public function createAttribute(name:DOMString):Attr

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 1 Core 

Creates an Attr of the given name. Note that the Attr instance can then be set on an Element using the setAttributeNode method. To create an attribute with a qualified name and namespace URI, use the createAttributeNS method.

Parameters

name:DOMString — The name of the attribute.

Returns
Attr — A new Attr object with the nodeName attribute set to name, and localName, prefix, and namespaceURI set to null. The value of the attribute is the empty string.

Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.

See also


Example
         <html>
         
         <head>
         <title> create/set/get Attribute example</title>
         
         <script type="text/javascript">
         
         function doAttrib() {
             var node = document.getElementById("div1");
             var a = document.createAttribute("my_attrib");
             a.nodeValue = "newVal";
             node.setAttributeNode(a);
             alert(node.getAttribute("my_attrib")); // "newVal"
         }
         
         // alternative form not actually using createAttribute
         //function doAttrib() {
         //var node = document.getElementById("div1");
         //node.setAttribute("my_attrib", "newVal");
         //alert(node.getAttribute("my_attrib")); // "newVal"
         //}
         
         </script>
         
         </head>
         
         <body onload="doAttrib();">
             <div id="div1">
                 <p>Some content here</p>
             </div>
         </body>
         </html>
DOM 2 Core createAttributeNS()method 
public function createAttributeNS(namespaceURI:DOMString, qualifiedName:DOMString):Attr

Introduced in: DOM 2 Core 

Creates an attribute of the given qualified name and namespace URI. Per XML Namespaces, applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Parameters

namespaceURI:DOMString — The namespace URI of the attribute to create.
 
qualifiedName:DOMString — The qualified name of the attribute to instantiate.

Returns
Attr — A new Attr object with the following attributes:
AttributeValue
Node.nodeNamequalifiedName
Node.namespaceURInamespaceURI
Node.prefixprefix, extracted from qualifiedName, or null if there is no prefix
Node.localNamelocal name, extracted from qualifiedName
Attr.namequalifiedName
Node.nodeValuethe empty string

Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified qualifiedName is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
 
DOMException — NAMESPACE_ERR: Raised if the qualifiedName is a malformed qualified name, if the qualifiedName has a prefix and the namespaceURI is null, if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from "http://www.w3.org/XML/1998/namespace", if the qualifiedName or its prefix is "xmlns" and the namespaceURI is different from "http://www.w3.org/2000/xmlns/", or if the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName nor its prefix is "xmlns".
 
DOMException — NOT_SUPPORTED_ERR: Always thrown if the current document does not support the "XML" feature, since namespaces were defined by XML.

See also

DOM 1 Core createCDATASection()method 
public function createCDATASection(data:DOMString):CDATASection

Introduced in: DOM 1 Core 

Creates a CDATASection node whose value is the specified string.

Note (Mozilla): Will throw a NS_ERROR_DOM_INVALID_CHARACTER_ERR exception if one tries to submit the closing CDATA sequence ("]]>") as part of the data, so unescaped user-provided data cannot be safely used without with this method getting this exception (createTextNode() can often be used in its place).

Parameters

data:DOMString — The data for the CDATASection contents.

Returns
CDATASection — The new CDATASection object.

Throws
DOMException — NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

See also


Example
         var docu = new DOMParser().parseFromString('<xml></xml>',  "application/xml");
         
         var cdata = docu.createCDATASection('Some <CDATA> data & then some');
         
         docu.getElementsByTagName('xml')[0].appendChild(cdata);
         
         alert(new XMLSerializer().serializeToString(docu));
         // Displays: <xml><![CDATA[Some <CDATA> data & then some]]></xml>
DOM 1 Core createComment()method 
public function createComment(data:DOMString):Comment

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 1 Core 

Creates a Comment node given the specified string.

Note (Mozilla): Will throw a NS_ERROR_DOM_INVALID_CHARACTER_ERR exception if one tries to include the "--" sequence as part of the data, so if based on user data, this potential string would need to be escaped or have its exception caught.

Parameters

data:DOMString — The data for the node.

Returns
Comment — The new Comment object.

See also


Example
         var docu = new DOMParser().parseFromString('<xml></xml>',  "application/xml");
         
         var comment = docu.createComment('This is a not-so-secret comment in your document');
         
         docu.getElementsByTagName('xml')[0].appendChild(comment);
         
         alert(new XMLSerializer().serializeToString(docu));
         // Displays: <xml><!--This is a not-so-secret comment in your document--></xml>
DOM 1 Core createDocumentFragment()method 
public function createDocumentFragment():DocumentFragment

Introduced in: DOM 1 Core 

Creates an empty DocumentFragment object.

Returns
DocumentFragment — A new DocumentFragment.

See also


Example
         var frag = document.createDocumentFragment();
         frag.appendChild(document.createTextNode('Ipsum Lorem'));
         document.body.appendChild(frag);
DOM 1 Core createElement()method 
public function createElement(tagName:DOMString):Element

Introduced in: DOM 1 Core 

Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object. In addition, if there are known attributes with default values, Attr nodes representing them are automatically created and attached to the element. To create an element with a qualified name and namespace URI, use the createElementNS method.

Note (Mozilla): Gecko implementation of createElement doesn't conform to the DOM spec for XUL and XHTML documents: localName and namespaceURI are not set to null on the created element. See bug 280692 for details.

Note (IE): In Microsoft Internet Explorer 4.0, the only new elements you can create are img, area, and option. As of Internet Explorer 5, you can create all elements programmatically, except frame and iframe. The properties of these created elements are read/write and can be accessed programmatically. Before you use new objects, you must explicitly add them to their respective collections or to the document. To insert new elements into the current document, use the insertBefore method or the appendChild method.

Note (IE): You must perform a second step when you use createElement to create the input element. The createElement method generates an input text box, because that is the default input type property. To insert any other kind of input element, first invoke createElement for input, and then set the type property to the appropriate value in the next line of code.

Note (IE): Attributes can be included with the tagName as long as the entire string is valid HTML. To include the NAME attribute at run time on objects created with the createElement method, use the tagName.

Note (IE): Use the tagName to include attributes when form elements are created that will be reset using the reset method or a BUTTON with a TYPE attribute value of reset.

Parameters

tagName:DOMString — The name of the element type to instantiate. For XML, this is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use. In that case, the name is mapped to the canonical form of that markup by the DOM implementation.

Returns
Element — A new Element object with the nodeName attribute set to tagName, and localName, prefix, and namespaceURI set to null.

Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.

See also


Example
This creates a new <div> and inserts it before the element with id "org_div1":
         <html>
         <head>
         <title>||Working with elements||</title>
         </head>
         
         <script type="text/javascript">
         var my_div = null;
         var newDiv = null;
         
         function addElement() {
         // create a new div element
         // and give it some content
         newDiv = document.createElement("div");
         newDiv.innerHTML = "<h1>Hi there and greetings!</h1>";
         
         // add the newly created element and it's content into the DOM
         my_div = document.getElementById("org_div1");
         document.body.insertBefore(newDiv, my_div);
         }
         
         
         </script>
         
         <body onload="addElement()">
             <div id='org_div1'> The text above has been created dynamically.</div>
         </body>
         </html>
DOM 2 Core createElementNS()method 
public function createElementNS(namespaceURI:DOMString, qualifiedName:DOMString):Element

Introduced in: DOM 2 Core 

Creates an element of the given qualified name and namespace URI. Per XML Namespaces, applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Parameters

namespaceURI:DOMString — The namespace URI of the element to create.
 
qualifiedName:DOMString — The qualified name of the element type to instantiate.

Returns
Element — A new Element object with the following attributes:
AttributeValue
Node.nodeNamequalifiedName
Node.namespaceURInamespaceURI
Node.prefixprefix, extracted from qualifiedName, or null if there is no prefix
Node.localNamelocal name, extracted from qualifiedName
Element.tagNamequalifiedName

Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified qualifiedName is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
 
DOMException — NAMESPACE_ERR: Raised if the qualifiedName is a malformed qualified name, if the qualifiedName has a prefix and the namespaceURI is null, or if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from "http://www.w3.org/XML/1998/namespace" [XML Namespaces], or if the qualifiedName or its prefix is "xmlns" and the namespaceURI is different from "http://www.w3.org/2000/xmlns/", or if the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName nor its prefix is "xmlns".
 
DOMException — NOT_SUPPORTED_ERR: Always thrown if the current document does not support the "XML" feature, since namespaces were defined by XML.

See also


Example
This creates a new <div> element in the XHTML namespace and appends it to the vbox element. Although this is not an extremely useful XUL document, it does demonstrate the use of elements from two different namespaces within a single document:
         <?xml version="1.0"?>
         <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
                 xmlns:html="http://www.w3.org/1999/xhtml"
                 title="||Working with elements||"
                 onload="init()">
         
         <script type="text/javascript"><![CDATA[
         var container;
         var newdiv;
         var txtnode;
         
         function init(){
             container = document.getElementById("ContainerBox");
             newdiv = document.createElementNS("http://www.w3.org/1999/xhtml","html:div");
             txtnode = document.createTextNode("This is text that was constructed dynamically with createElementNS and createTextNode then inserted into the document using appendChild.");
             newdiv.appendChild(txtnode);
             container.appendChild(newdiv);
         }
         
         ]]></script>
         
             <vbox id='ContainerBox' flex='1'>
                 <html:div>
                     The script on this page will add dynamic content below:
                 </html:div>
             </vbox>
         </page>

The example given above uses inline script which is not recommended in XHTML documents. This particular example is actually an XUL document with embedded XHTML, however, the recommendation still applies. Inline script does not cause any problems for this short example, however, for any serious work you should learn about Properly Using CSS and JavaScript in XHTML Documents.

DOM 1 Core createEntityReference()method 
public function createEntityReference(name:DOMString):EntityReference

Introduced in: DOM 1 Core 

Creates an EntityReference object. In addition, if the referenced entity is known, the child list of the EntityReference node is made the same as that of the corresponding Entity node.

Note: If any descendant of the Entity node has an unbound namespace prefix, the corresponding descendant of the created EntityReference node is also unbound; (its namespaceURI is null). The DOM Level 2 and 3 do not support any mechanism to resolve namespace prefixes in this case.

Parameters

name:DOMString — The name of the entity to reference. Unlike Document.createElementNS or Document.createAttributeNS, no namespace well-formed checking is done on the entity name. Applications should invoke Document.normalizeDocument() with the parameter "namespaces" set to true in order to ensure that the entity name is namespace well-formed.

Returns
EntityReference — The new EntityReference object.

Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
 
DOMException — NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

See also

DOM 2 Events createEvent()method 
public function createEvent(eventType:DOMString):Event

Introduced in: DOM 2 Events 

Creates an event object of the type specified.

Parameters

eventType:DOMString — The eventType parameter specifies the name of the DOM Events interface to be supported by the created event object, e.g. "Event", "MouseEvent", "MutationEvent" and so on. If the Event is to be dispatched via the EventTarget.dispatchEvent() method the appropriate event initialization method must be called after creation in order to initialize the Event's values. As an example, a user wishing to synthesize some kind of UIEvent would invoke DocumentEvent.createEvent("UIEvent"). The UIEvent.initUIEventNS() ethod could then be called on the newly created UIEvent object to set the specific type of user interface event to be dispatched, DOMActivate for example, and set its context information, e.g. UIEvent.detail in this example. For backward compatibility reason, "UIEvents", "MouseEvents", "MutationEvents", and "HTMLEvents" feature names are valid values for the parameter eventType and represent respectively the interfaces "UIEvent", "MouseEvent", "MutationEvent", and "Event", and the characters 'a'..'z' are considered equivalent to the characters 'A'..'Z'.

Returns
Event — The newly created event object.

See also

createEventObject()method 
public function createEventObject(existingEvent:Event = null):Event

Non-standard (Microsoft)

Generates an event object to pass event context information when you use the fireEvent method.

Parameters

existingEvent:Event (default = null) — A object that specifies an existing event object on which to base the new object.

Returns
Event — Returns an event object.

See also


Example
The following sample shows how to use the createEventObject method with the fireEvent method.
         <html>
         <body>
         <script>
             function OuterClick() {
                 if(event.expando == "from_inner") {
                     alert("Event actually fired by clicking on inner DIV!")
                 } else {
                     alert("Event fired by clicking on outer DIV!")
                 }
             }
             function InnerClick() {
                 var eventObj = document.createEventObject();
                 // Set an expando property on the event object. This will be used by the 
                 // event handler to determine what element was clicked on.
                 eventObj.expando = "from_inner";
                 parent.document.all.Outer.fireEvent("onclick",eventObj);
                 event.cancelBubble = true;
             }
         </script>
         <div id="Outer" onclick="OuterClick()" style="height:200;width:200;padding:50;background-color:mistyrose">
             <div id="Inner" onclick="InnerClick()" style="height:100;width:100;padding:25;background-color:lavender"></div>
         </div>
         
         </body>
         </html>
DOM 3 Load and Save createLSInput()method 
public function createLSInput():LSInput

Introduced in: DOM 3 Load and Save 

Create a new empty input source object where LSInput.characterStream, LSInput.byteStream, LSInput.stringData LSInput.systemId, LSInput.publicId, LSInput.baseURI, and LSInput.encoding are null, and LSInput.certifiedText is false.

Returns
LSInput — The newly created input object.

See also

DOM 3 Load and Save createLSOutput()method 
public function createLSOutput():LSOutput

Introduced in: DOM 3 Load and Save 

Create a new empty output destination object where LSOutput.characterStream, LSOutput.byteStream, LSOutput.systemId, LSOutput.encoding are null.

Returns
LSOutput — The newly created output object.

See also

DOM 3 Load and Save createLSParser()method 
public function createLSParser(mode:Number, schemaType:DOMString):LSParser

Introduced in: DOM 3 Load and Save 

Create a new LSParser. The newly constructed parser may then be configured by means of its DOMConfiguration object, and used to parse documents by means of its parse method.

Parameters

mode:Number — The mode argument is either MODE_SYNCHRONOUS or MODE_ASYNCHRONOUS, if mode is MODE_SYNCHRONOUS then the LSParser that is created will operate in synchronous mode, if it's MODE_ASYNCHRONOUS then the LSParser that is created will operate in asynchronous mode.
 
schemaType:DOMString — An absolute URI representing the type of the schema language used during the load of a Document using the newly created LSParser. Note that no lexical checking is done on the absolute URI. In order to create a LSParser for any kind of schema types (i.e. the LSParser will be free to use any schema found), use the value null.

Note: For W3C XML Schema [XML Schema Part 1], applications must use the value "http://www.w3.org/2001/XMLSchema". For XML DTD [XML 1.0], applications must use the value "http://www.w3.org/TR/REC-xml". Other Schema languages are outside the scope of the W3C and therefore should recommend an absolute URI in order to use this method.

Returns
LSParser — The newly created LSParser object. This LSParser is either synchronous or asynchronous depending on the value of the mode argument.

Note: By default, the newly created LSParser does not contain a DOMErrorHandler, i.e. the value of the "error-handler" configuration parameter is null. However, implementations may provide a default error handler at creation time. In that case, the initial value of the "error-handler" configuration parameter on the new LSParser object contains a reference to the default error handler.

See also

DOM 3 Load and Save createLSSerializer()method 
public function createLSSerializer():LSSerializer

Introduced in: DOM 3 Load and Save 

Create a new LSSerializer object.

Returns
LSSerializer — The newly created LSSerializer object.

Note: By default, the newly created LSSerializer has no DOMErrorHandler, i.e. the value of the "error-handler" configuration parameter is null. However, implementations may provide a default error handler at creation time. In that case, the initial value of the "error-handler" configuration parameter on the new LSSerializer object contains a reference to the default error handler.

See also

DOM 2 TR createNodeIterator()method 
public function createNodeIterator(root:Node, whatToShow:Number, filter:NodeFilter, entityReferenceExpansion:Boolean):NodeIterator

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 2 Core 

Create a new NodeIterator over the subtree rooted at the specified node.

Parameters

root:Node — The node which will be iterated together with its children. The iterator is initially positioned just before this node. The whatToShow flags and the filter, if any, are not considered when setting this position. The root must not be null.
 
whatToShow:Number — This flag specifies which node types may appear in the logical view of the tree presented by the iterator. These flags can be combined using OR.
 
filter:NodeFilter — The NodeFilter to be used with this TreeWalker, or null to indicate no filter.
 
entityReferenceExpansion:Boolean — The value of this flag determines whether entity reference nodes are expanded.

Returns
NodeIterator — The newly created NodeIterator.

See also


Example
         var nodeIterator = document.createNodeIterator(
             document.body,
             NodeFilter.SHOW_ELEMENT,
             { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
             false
             );
         var nodeList = new Array();
         var currentNode;
         
         while (currentNode = nodeIterator.nextNode()) {
             nodeList.push(currentNode);
         }
DOM 1 Core createProcessingInstruction()method 
public function createProcessingInstruction(target:DOMString, data:DOMString):ProcessingInstruction

Introduced in: DOM 1 Core 

Creates a ProcessingInstruction node given the specified name and data strings.

Parameters

target:DOMString — The target part of the processing instruction. Unlike Document.createElementNS or Document.createAttributeNS, no namespace well-formed checking is done on the target name. Applications should invoke Document.normalizeDocument() with the parameter "namespaces" set to true in order to ensure that the target name is namespace well-formed.
 
data:DOMString — The data for the node.

Returns
ProcessingInstruction — The new ProcessingInstruction object.

Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified target is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
 
DOMException — NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

See also


Example
         var docu = new DOMParser().parseFromString('<xml></xml>',  "application/xml");
         
         var pi = docu.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"');
         
         docu.getElementsByTagName('xml')[0].appendChild(pi);
         
         alert(new XMLSerializer().serializeToString(docu));
         // Displays: <xml><?xml-stylsheet href="mycss.css" type="text/css"?></xml>
DOM 2 TR createRange()method 
public function createRange():Range

Introduced in: DOM 2 Core 

This interface can be obtained from the object implementing the Document interface using binding-specific casting methods.

Returns
Range — The initial state of the Range returned from this method is such that both of its boundary-points are positioned at the beginning of the corresponding Document, before any content. The Range returned can only be used to select content associated with this Document, or with DocumentFragments and Attrs for which this Document is the ownerDocument.

See also


Example
         var range = document.createRange();
         range.setStart(startNode, startOffset);
         range.setEnd(endNode, endOffset);
createStyleSheet()method 
public function createStyleSheet(url:DOMString = null, index:Number):StyleSheet

Non-standard (Microsoft)

Creates a style sheet for the document.

Note (IE): You can create up to 31 styleSheet objects with the createStyleSheet method. After that, the method returns an "Invalid Argument" exception. To create additional objects, use createElement and append them to the HEAD of the document as follows:

         var styleSheet = document.createElement('STYLE');
         document.documentElement.firstChild.appendChild(styleSheet);

Parameters

url:DOMString (default = null) — Specifies how to add the style sheet to the document. If a file name is specified for the URL, the style information is added as a link object. If the URL contains style information, it is added to the style object.
 
index:Number (default = NaN) — The index that indicates where the new style sheet is inserted in the styleSheets collection. The default is to insert the new style sheet at the end of the collection.

Returns
StyleSheet — Returns a styleSheet object.

See also


Example
This example uses the createStyleSheet method to create a link to a style sheet.
document.createStyleSheet('styles.css');
DOM 1 Core createTextNode()method 
public function createTextNode(data:DOMString):Text

Introduced in: DOM 1 Core 

Creates a Text node given the specified string.

Parameters

data:DOMString — The data for the node.

Returns
Text — The new Text object.

See also


Example
         <html>
         <head>
         <title>createTextNode example</title>
         
         <script type="text/javascript">
         
         function addTextNode() {
             var newtext = document.createTextNode(" Some text added dynamically. ");
             var para = document.getElementById("p1");
             para.appendChild(newtext);
         }
         
         </script>
         </head>
         
         <body>
         <div style="border: 1px solid red">
         <p id="p1">First line of paragraph.<br /></p>
         </div><br />
         
         <button onclick="addTextNode();">add another textNode.</button>
         
         </body>
         </html>
DOM 2 TR createTreeWalker()method 
public function createTreeWalker(root:Node, whatToShow:Number, filter:NodeFilter, entityReferenceExpansion:Boolean):TreeWalker

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 2 Core 

Create a new TreeWalker over the subtree rooted at the specified node.

Parameters

root:Node — The node which will serve as the root for the TreeWalker. The whatToShow flags and the NodeFilter are not considered when setting this value; any node type will be accepted as the root. The currentNode of the TreeWalker is initialized to this node, whether or not it is visible. The root functions as a stopping point for traversal methods that look upward in the document structure, such as parentNode and nextNode. The root must not be null.
 
whatToShow:Number — This flag specifies which node types may appear in the logical view of the tree presented by the tree-walker. These flags can be combined using OR.
 
filter:NodeFilter — The NodeFilter to be used with this TreeWalker, or null to indicate no filter.
 
entityReferenceExpansion:Boolean — If this flag is false, the contents of EntityReference nodes are not presented in the logical view.

Returns
TreeWalker — The newly created TreeWalker.

See also


Example
         var treeWalker = document.createTreeWalker(
             document.body,
             NodeFilter.SHOW_ELEMENT,
             { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
             false
             );
         var nodeList = new Array();
         while(treeWalker.nextNode()) nodeList.push(treeWalker.currentNode);
detachEvent()method 
public function detachEvent(type:DOMString, listener:Function):void

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a

Non-standard (Microsoft)

Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.

Note (IE): Behaviors that attach to events using the attachEvent method must explicitly call the detachEvent method to stop receiving notifications from the page when the ondetach event fires. Behaviors that attach to events using the PUBLIC:ATTACH element automatically stop receiving notifications when the behavior detaches from the element, and thus do not need to call the detachEvent method.

Parameters

type:DOMString — Specifies any of the standard DHTML Events.
 
listener:Function — Specifies the function previously set using the attachEvent method.

See also


Example
This example calls the detachEvent method from an HTML Component (HTC) when the highlighting effect is removed from the page, causing the ondetach event to fire.
         <PUBLIC:ATTACH EVENT="ondetach" ONEVENT="cleanup()" />
         
         <script language="JScript">
         attachEvent ('onmouseover', Hilite);
         attachEvent ('onmouseout', Restore);
         
         function cleanup() {
             detachEvent ('onmouseover', Hilite);
             detachEvent ('onmouseout', Restore);
         }
         
         function Hilite() {
             if (event.srcElement == element) { 
                 normalColor = style.color;  
                 runtimeStyle.color  = "red";
                 runtimeStyle.cursor = "hand";
             }
         }
         
         function Restore() {
             if (event.srcElement == element) {
                 runtimeStyle.color  = normalColor;
                 runtimeStyle.cursor = "";
             }
         }
         </script>
CSSOM View elementFromPoint()method 
public function elementFromPoint(x:Number, y:Number):Element

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 0 
Modified in: DOM 3 Core 

Returns the element from the document whose elementFromPoint method is being called which is the topmost element which lies under the given point.

The point is specified via coordinates, in CSS pixels, relative to the upper-left-most point in the window or frame containing the document.

Note: If the element at the specified point belongs to another document (for example, an iframe's subdocument), the element in the DOM of the document the method is called on (in the iframe case, the iframe itself) is returned. If the element at the given point is anonymous or XBL generated content, such as a textbox's scroll bars, then the first non-anonymous ancestor element (for example, the textbox) is returned.

Note: If the specified point is outside the visible bounds of the document or either coordinate is negative, the result is null.

Note: The browsers do not entirely agree which mouse coordinates this method needs. IE and Firefox 3 need clientX/Y (relative to the viewport), while Opera and Safari need pageX/Y (relative to the document).

Parameters

x:Number — The X coordinate to check, in CSS pixels relative to the upper-left corner of the document's containing window or frame.
 
y:Number — The Y coordinate to check, in CSS pixels relative to the upper-left corner of the document's containing window or frame.

Returns
Element — The element at x,y in the viewport

See also


Example
         <html>
             <head>
                 <title>elementFromPoint example</title>
                 <script type="text/javascript">
                     function changeColor(newColor) {
                         elem = document.elementFromPoint(2, 2);
                         elem.style.color = newColor;
                     }
                 </script>
             </head>
         
             <body>
                 <p id="para1">Some text here</p>
                 <button onclick="changeColor('blue');">blue</button>
                 <button onclick="changeColor('red');">red</button>
             </body>
         </html>
         
CSSOM enableStylesheetsForSet()method 
public function enableStylesheetsForSet(name:DOMString):void

Introduced in: CSSOM 

Invoking this method must change the disabled attribute on each StyleSheet object with a title in the styleSheets attribute, so that all those whose title matches the name argument are enabled, and all others are disabled. Title matches must be case-sensitive.

Invoking this method with the empty string value must disable all alternative and preferred style sheets (but does not change the state of persistent style sheets).

Invoking this method with the null value must have no effect.

Style sheets that do not have a title are never affected by this method. This method does not change the values of the lastStyleSheetSet or preferredStyleSheetSet attributes.

Parameters

name:DOMString

See also

DOM 1 Core getElementsByTagName()method 
public function getElementsByTagName(tagname:DOMString):NodeList

Introduced in: DOM 1 Core 

Returns a NodeList of all the Elements in document order with a given tag name and are contained in the document.

Parameters

tagname:DOMString — The name of the tag to match on. The special value "*" matches all tags. For XML, the tagname parameter is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use.

Returns
NodeList — A new NodeList object containing all the matched Elements.

See also

DOM 2 Core getElementsByTagNameNS()method 
public function getElementsByTagNameNS(namespaceURI:DOMString, localName:DOMString):NodeList

Introduced in: DOM 2 Core 

Returns a NodeList of all the Elements with a given local name and namespace URI in document order.

Parameters

namespaceURI:DOMString — The namespace URI of the elements to match on. The special value "*" matches all namespaces.
 
localName:DOMString — The local name of the elements to match on. The special value "*" matches all local names.

Returns
NodeList — A new NodeList object containing all the matched Elements.

See also

DOM 1 HTML getElemenyById()method 
public function getElemenyById(elementId:DOMString):Element

Introduced in: DOM 1 HTML 
Modified in: DOM 2 Core 

Returns the Element that has an ID attribute with the given value. If no such element exists, this returns null. If more than one element has an ID attribute with that value, what is returned is undefined.

Note: Attributes with the name "ID" or "id" are not of type ID unless so defined.

Note: Simply creating an element and assigning an ID will not make the element accessible by getElementById. Instead one needs to insert the element first into the document tree with insertBefore or a similar method, probably into a hidden div.

var element = document.createElement("div");
         element.id = 'testqq';
         var el = document.getElementById('testqq'); // el will be null!
New users should note that the capitalization of 'Id' must be correct for the code to function - 'getElementByID' does not work, however natural it may seem.

Note (IE): In IE8 mode, getElementById performs a case-sensitive match on the ID attribute only. In IE7 mode and previous modes, this method performs a case-insensitive match on both the ID and NAME attributes, which might produce unexpected results.

Parameters

elementId:DOMString — The unique id value for an element.

Returns
Element — The matching element or null if there is none.

See also


Example
         <html>
         <head>
         <title>getElementById example</title>
         
         <script type="text/javascript">
         function changeColor(newColor) {
             elem = document.getElementById("para1");
             elem.style.color = newColor;
         }
         </script>
         </head>
         
         <body>
         <p id="para1">Some text here</p>
         <button onclick="changeColor('blue');">blue</button>
         <button onclick="changeColor('red');">red</button>
         </body>
         </html>
DOM 2 Style getOverrideStyle()method 
public function getOverrideStyle(elt:Element, pseudoElt:DOMString):CSSStyleDeclaration

Introduced in: DOM 2 Core 

This method is used to retrieve the override style declaration for a specified element and a specified pseudo-element.

Parameters

elt:Element — The element whose style is to be modified. This parameter cannot be null.
 
pseudoElt:DOMString — The pseudo-element or null if none.

Returns
CSSStyleDeclaration — The override style declaration.

See also

DOM 2 Core importNode()method 
public function importNode(importedNode:Node, deep:Boolean):Node

Introduced in: DOM 2 Core 

Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node. The returned node has no parent; (parentNode 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, localName, and namespaceURI). As in the cloneNode operation, the source node is not altered. User data associated to the imported node is not carried over. However, if any UserDataHandlers has been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.

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 each type of node.

Node TypeDescription
ATTRIBUTE_NODEThe ownerElement attribute is set to null and the specified flag is set to true on the generated Attr. The descendants of the source Attr are recursively imported and the resulting nodes reassembled to form the corresponding subtree. Note that the deep parameter has no effect on Attr nodes; they always carry their children with them when imported.
DOCUMENT_FRAGMENT_NODEIf the deep option was set to true, the descendants of the source DocumentFragment are recursively imported and the resulting nodes reassembled under the imported DocumentFragment to form the corresponding subtree. Otherwise, this simply generates an empty DocumentFragment.
DOCUMENT_NODEDocument nodes cannot be imported.
DOCUMENT_TYPE_NODEDocumentType nodes cannot be imported.
ELEMENT_NODESpecified attribute nodes of the source element are imported, and the generated 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 the importNode deep parameter was set to true, the descendants of the source element are recursively imported and the resulting nodes reassembled to form the corresponding subtree.
ENTITY_NODEEntity nodes can be imported, however in the current release of the DOM the DocumentType is readonly. Ability to add these imported nodes to a DocumentType will be considered for addition to a future release of the DOM. On import, the publicId, systemId, and notationName attributes are copied. If a deep import is requested, the descendants of the the source Entity are recursively imported and the resulting nodes reassembled to form the corresponding subtree.
ENTITY_REFERENCE_NODEOnly the EntityReference itself is copied, even if a deep import is 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.
NOTATION_NODENotation nodes can be imported, however in the current release of the DOM the DocumentType is readonly. Ability to add these imported nodes to a DocumentType will be considered for addition to a future release of the DOM. On import, the publicId and systemId attributes are copied. Note that the deep parameter has no effect on this type of nodes since they cannot have any children.
PROCESSING_INSTRUCTION_NODEThe imported node copies its target and data values from those of the source node. Note that the deep parameter has no effect on this type of nodes since they cannot have any children.
TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODEThese three types of nodes inheriting from CharacterData copy their data and length attributes from those of the source node. Note that the deep parameter has no effect on these types of nodes since they cannot have any children.

Note: The original node is not removed from the original document. The imported node is a clone of the original.

Parameters

importedNode:Node — The node to import.
 
deep:Boolean — If true, recursively import the subtree under the specified node; if false, import only the node itself, as explained above. This has no effect on nodes that cannot have any children, and on Attr, and EntityReference nodes.

Returns
Node — The imported node that belongs to this Document.

Throws
DOMException — NOT_SUPPORTED_ERR: Raised if the type of node being imported is not supported.
 
DOMException — INVALID_CHARACTER_ERR: Raised if one of the imported names is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute. This may happen when importing an XML 1.1 element into an XML 1.0 document, for instance.

See also


Example
         var iframe = document.getElementsByTagName("iframe")[0];
         var oldNode = iframe.contentDocument.getElementById("myNode");
         var newNode = document.importNode(oldNode,true);
         document.getElementById("container").appendChild(newNode);
DOM 3 Load and Save Obsolete load()method 
public function load(uri:DOMString):Boolean

Obsolete

Replaces the content of the document with the result of parsing the given URI. Invoking this method will either block the caller or return to the caller immediately depending on the value of the async attribute. Once the document is fully loaded the document will fire a "load" event that the caller can register as a listener for. If an error occurs the document will fire an "error" event so that the caller knows that the load failed (see ParseErrorEvent). If this method is called on a document that is currently loading, the current load is interrupted and the new URI load is initiated.

Note (Mozilla): As of at least Gecko 1.9, this no longer supports cross-site loading of documents (Use XMLHttpRequest instead).

Parameters

uri:DOMString — The URI reference for the XML file to be loaded. If this is a relative URI, the base URI used by the implementation is implementation dependent.

Returns
Boolean — If async is set to true load returns true if the document load was successfully initiated. If an error occurred when initiating the document load load returns false. If async is set to false load returns true if the document was successfully loaded and parsed. If an error occurred when either loading or parsing the URI load returns false.

See also


Example
         var xmlDoc = document.implementation.createDocument("", "test", null);
         function documentLoaded (e) {
             alert(new XMLSerializer().serializeToString(e.target)); // Gives querydata.xml contents as string
         }
         xmlDoc.addEventListener("load", documentLoaded, false);
         xmlDoc.load('querydata.xml');
DOM 3 Load and Save Obsolete loadXML()method 
public function loadXML(source:DOMString):Boolean

Obsolete

Replace the content of the document with the result of parsing the input string, this method is always synchronous. This method always parses from a DOMString, which means the data is always UTF16. All other encoding information is ignored.

Parameters

source:DOMString — A string containing an XML document.

Returns
Boolean — true if parsing the input string succeeded without errors, otherwise false.

See also

DOM 3 Core normalizeDocument()method 
public function normalizeDocument():void

Introduced in: DOM 3 Core 

This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form. As a consequence, this method updates the replacement tree of EntityReference nodes and normalizes Text nodes, as defined in the method Node.normalize(). Otherwise, the actual result depends on the features being set on the Document.domConfig object and governing what operations actually take place. Noticeably this method could also make the document namespace well-formed according to the algorithm described in Namespace Normalization, check the character normalization, remove the CDATASection nodes, etc. See DOMConfiguration for details.

         // Keep in the document the information defined
         // in the XML Information Set (Java example)
         DOMConfiguration docConfig = myDocument.getDomConfig();
         docConfig.setParameter("infoset", Boolean.TRUE);
         myDocument.normalizeDocument();

Mutation events, when supported, are generated to reflect the changes occurring on the document. If errors occur during the invocation of this method, such as an attempt to update a read-only node or a Node.nodeName contains an invalid character according to the XML version in use, errors or warnings (DOMError.SEVERITY_ERROR or DOMError.SEVERITY_WARNING) will be reported using the DOMErrorHandler object associated with the "error-handler" parameter. Note this method might also report fatal errors (DOMError.SEVERITY_FATAL_ERROR) if an implementation cannot recover from an error.

See also

Selectors API querySelector()method 
public function querySelector(selectors:DOMString):Element

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b
Introduced in: DOM 3 Core 

Returns the first element that is a descendent of the element on which it is invoked that matches the specified group of selectors.

Parameters

selectors:DOMString — One or more selectors

Returns
Element — The first matching Element node within the node’s subtree. If there is no such node, returns null.

See also


Example
         <html xmlns="http://www.w3.org/1999/xhtml">
             <head>
                 <title>Selectors API Example</title>
             </head>
             <body>
         
                 <div id="foo">
                     <p class="warning">This is a sample warning</p>
                     <p class="error">This is a sample error</p>
                 </div>
                 <div id="bar">
                     <p>...</p>
                 </div>
             </body>
         </html>
x would contain the first element in the document with an ID of either foo or bar (or both). In the sample document above, it would select the div element with the ID of foo because it is first in document order.
var x = document.querySelector("#foo, #bar");
Selectors API querySelectorAll()method 
public function querySelectorAll(selectors:DOMString):NodeList

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b
Introduced in: DOM 3 Core 

Returns a list of all elements descended from the element on which it is invoked that match the specified group of selectors.

Parameters

selectors:DOMString — One or more selectors

Returns
NodeList — A NodeList containing all of the matching Element nodes within the node’s subtree, in document order. If there are no such nodes, returns an empty NodeList.

See also


Example
         <html xmlns="http://www.w3.org/1999/xhtml">
             <head>
                 <title>Selectors API Example</title>
             </head>
             <body>
         
                 <div id="foo">
                     <p class="warning">This is a sample warning</p>
                     <p class="error">This is a sample error</p>
                 </div>
                 <div id="bar">
                     <p>...</p>
                 </div>
             </body>
         </html>
The following example would select all p elements in the document that have a class of either "error" or "warning".
var alerts = document.querySelectorAll("p.warning, p.error");
DOM 3 Core renameNode()method 
public function renameNode(n:Node, namespaceURI:DOMString, qualifiedName:DOMString):Node

Introduced in: DOM 3 Core 

Rename an existing node of type ELEMENT_NODE or ATTRIBUTE_NODE. When possible this simply changes the name of the given node, otherwise this creates a new node with the specified name and replaces the existing node with the new node as described below. If simply changing the name of the given node is not possible, the following operations are performed: a new node is created, any registered event listener is registered on the new node, any user data attached to the old node is removed from that node, the old node is removed from its parent if it has one, the children are moved to the new node, if the renamed node is an Element its attributes are moved to the new node, the new node is inserted at the position the old node used to have in its parent's child nodes list if it has one, the user data that was attached to the old node is attached to the new node.

When the node being renamed is an Element only the specified attributes are moved, default attributes originated from the DTD are updated according to the new element name. In addition, the implementation may update default attributes from other schemas. Applications should use Document.normalizeDocument() to guarantee these attributes are up-to-date.

When the node being renamed is an Attr that is attached to an Element, the node is first removed from the Element attributes map. Then, once renamed, either by modifying the existing node or creating a new one as described above, it is put back. In addition,

Parameters

n:Node — The node to rename.
 
namespaceURI:DOMString — The new namespace URI.
 
qualifiedName:DOMString — The new qualified name.

Returns
Node — The renamed node. This is either the specified node or the new node that was created to replace the specified node.

Throws
DOMException — NOT_SUPPORTED_ERR: Raised when the type of the specified node is neither ELEMENT_NODE nor ATTRIBUTE_NODE, or if the implementation does not support the renaming of the document element.
 
DOMException — INVALID_CHARACTER_ERR: Raised if the new qualified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
 
DOMException — WRONG_DOCUMENT_ERR: Raised when the specified node was created from a different document than this document.
 
DOMException — NAMESPACE_ERR: Raised if the qualifiedName is a malformed qualified name, if the qualifiedName has a prefix and the namespaceURI is null, or if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from "http://www.w3.org/XML/1998/namespace" XML Namespaces. Also raised, when the node being renamed is an attribute, if the qualifiedName, or its prefix, is "xmlns" and the namespaceURI is different from "http://www.w3.org/2000/xmlns/".

See also

DOM 3 Load and Save Obsolete saveXML()method 
public function saveXML(snode:Node):DOMString

Obsolete

Save the document or the given node to a string (i.e. serialize the document or node).

Parameters

snode:Node — Specifies what to serialize, if this parameter is null the whole document is serialized, if it's non-null the given node is serialized.

Returns
DOMString — The serialized document or null.

See also

updateSettings()method 
public function updateSettings():void

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b

Non-standard (Microsoft)

Allows updating the print settings for the page.

See also

Event Detail
DOMSubtreeModified Event
Event Object Type: dom.events.MutationEvent
MutationEvent.type property = DOMSubtreeModified

This is a general event for notification of all changes to the document. It can be used instead of the more specific mutation and mutation name events listed below. It may be dispatched after a single modification to the document or, at the implementation's discretion, after multiple changes have occurred. The latter use should generally be used to accommodate multiple changes which occur either simultaneously or in rapid succession. The target of this event is the lowest common parent of the changes which have taken place. This event is dispatched after any other events caused by the mutation(s) have occurred.

load Event  
Event Object Type: dom.events.Event
Event.type property = load

The DOM Implementation finishes loading the resource (such as the document) and any dependent resources (such as images, style sheets, or scripts). Dependent resources that fail to load will not prevent this event from firing if the resource that loaded them is still accessible via the DOM. If this event type is dispatched, implementations are required to dispatch this event at least on the Document node.

mousemultiwheel Event  
Event Object Type: dom.events.MouseMultiWheelEvent
MouseMultiWheelEvent.type property = mousemultiwheel

A mouse wheel has been rotated. A default action of user agent generated event objects of this type causes implementations to dispatch a mousewheel event iff it supports that event type and MouseMultiWheelEvent.wheelDeltaY is non-zero.

mousewheel Event  
Event Object Type: dom.events.MouseWheelEvent
MouseWheelEvent.type property = mousewheel

A mouse wheel has been rotated around the y-axis.

offline Event  
Event Object Type: dom.events.Event
Event.type property = offline

Is fired when the browser switches between online and offline mode.

online Event  
Event Object Type: dom.events.Event
Event.type property = online

Is fired when the browser switches between online and offline mode.

resize Event  
Event Object Type: dom.events.Event
Event.type property = resize

A document view or an element has been resized. The resize occured before the dispatch of this event type.

scroll Event  
Event Object Type: dom.events.Event
Event.type property = scroll

A document view or an element has been scrolled. The scroll occured before the dispatch of this event type.

unload Event  
Event Object Type: dom.events.Event
Event.type property = unload

The DOM implementation removes from the environment the resource (such as the document) or any dependent resources (such as images, style sheets, scripts). The document is unloaded after the dispatch of this event type. If this event type is dispatched, implementations are required to dispatch this event at least on the Document node.