WD-DOM-Level-2-19990719 Document Object Model (DOM) Level 2 Specification Version 1.0 W3C Working Draft 19 July, 1999 This version: http://www.w3.org/TR/1999/WD-DOM-Level-2-19990719 (PostScript file, PDF file, plain text, ZIP file) Latest version: http://www.w3.org/TR/WD-DOM-Level-2 Previous versions: http://www.w3.org/TR/1999/WD-DOM-Level-2-19990304 WG Chair: Lauren Wood, SoftQuad Software Inc. Editors: Vidur Apparao, Netscape Communications Corporation Mike Champion, Arbortext and Software AG Joe Kesselman, IBM Arnaud Le Hors, W3C Philippe Le Hégaret, W3C Tom Pixley, Netscape Communications Corporation Jonathan Robie, Texcel Research and Software AG Peter Sharpe, SoftQuad Software Inc. Chris Wilson, Microsoft Lauren Wood, SoftQuad Software Inc. ------------------------------------------------------------------------ Status of this document This document is an early release of the Document Object Model Level 2. It is guaranteed to change; anyone implementing it should realize that we will not allow ourselves to be restricted by experimental implementations of Level 2 when deciding whether to change the specifications. This is a W3C Working Draft for review by W3C members and other interested parties. It is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress". This is work in progress and does not imply endorsement by, or the consensus of, either W3C or members of the DOM working group. This document has been produced as part of the W3C DOM Activity. The authors of this document are the DOM WG members. Different modules of the Document Object Model have different editors. This document is for public review. Comments on this document should be sent to the public mailing list www-dom@w3.org. ------------------------------------------------------------------------ Abstract This specification defines the Document Object Model Level 2, a platform- and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure and style of documents. The Document Object Model Level 2 builds on the Document Object Model Level 1. This release of the Document Object Model Level 2 has all of the interfaces that the final version is expected to have. It contains interfaces for creating a document, importing a node from one document to another, supporting XML namespaces, associating stylesheets with a document, the Cascading Style Sheets object model, the Range object model, filters and iterators, and the Events object model. The DOM WG wants to get feedback on these, and especially on the two options presented for XML namespaces, so that final decisions can be made for the DOM Level 2 specification. Table of contents * Expanded Table of Contents * Copyright Notice * Chapter 1: Document Object Model (Core) Level 2 * Chapter 2: Document Object Model Namespaces * Chapter 3: Document Object Model StyleSheets * Chapter 4: Document Object Model CSS * Chapter 5: Document Object Model Events * Chapter 6: Document Object Model Filters and Iterators * Chapter 7: Document Object Model Range * Appendix A: Contributors * Appendix B: Glossary * Appendix C: IDL Definitions * Appendix D: Java Language Binding * Appendix E: ECMA Script Language Binding * References * Index Expanded Table of Contents * Expanded Table of Contents * Copyright Notice * Chapter 1: Document Object Model (Core) Level 2 o 1.1. Overview of the DOM Level 2 Core Interfaces o 1.2. The Core Interfaces o 1.3. The HTML Interfaces o 1.4. Open Issues * Chapter 2: Document Object Model Namespaces o 2.1. Introduction o 2.2. The Namespaces related Interfaces Option #1 o 2.3. Further Considerations about Namespaces and Option #1 o 2.4. The Namespaces Support Option #2 o 2.5. Further Considerations about Option #2 o 2.6. Open Issues * Chapter 3: Document Object Model StyleSheets o 3.1. Introduction o 3.2. Style Sheet Interfaces o 3.3. Document Extensions * Chapter 4: Document Object Model CSS o 4.1. Overview of the DOM Level 2 CSS Interfaces o 4.2. CSS Fundamental Interfaces o 4.3. CSS Extended Interfaces o 4.4. Extensions to Level 1 Interfaces + 4.4.1. HTMLElement inline style + 4.4.2. HTMLStyleElement style sheet + 4.4.3. HTMLLinkElement style sheet o 4.5. Unresolved Issues * Chapter 5: Document Object Model Events o 5.1. Overview of the DOM Level 2 Event Model + 5.1.1. Terminology + 5.1.2. Requirements o 5.2. Description of event flow + 5.2.1. Basic event flow + 5.2.2. Event Capture + 5.2.3. Event bubbling + 5.2.4. Event cancellation o 5.3. Event listener registration + 5.3.1. Event registration interfaces + 5.3.2. Interaction with HTML 4.0 event listeners + 5.3.3. Event listener registration issues o 5.4. Event interfaces o 5.5. Event set definitions + 5.5.1. User Interface event types + 5.5.2. Mutation event types + 5.5.3. HTML event types * Chapter 6: Document Object Model Filters and Iterators o 6.1. Overview of the DOM Level 2 Iterator, Filter, and TreeWalker Interfaces + 6.1.1. Iterators + 6.1.2. Filters + 6.1.3. TreeWalker o 6.2. Formal Interface Definition * Chapter 7: Document Object Model Range o 7.1. Introduction o 7.2. Definitions and Notation + 7.2.1. Position + 7.2.2. Selection and Partial Selection + 7.2.3. Notation o 7.3. Creating a Range o 7.4. Changing a Range's Position o 7.5. Comparing Range End-Points o 7.6. Deleting Content with a Range o 7.7. Extracting Content o 7.8. Cloning Content o 7.9. Inserting Content o 7.10. Surrounding Content o 7.11. Miscellaneous Members o 7.12. Range modification under document mutation + 7.12.1. Insertions + 7.12.2. Deletions o 7.13. Formal Description of the Range Interface * Appendix A: Contributors * Appendix B: Glossary * Appendix C: IDL Definitions o C.1. Document Object Model Level 2 Core o C.2. Document Object Model Level 2 Namespaces o C.3. Document Object Model Level 2 Stylesheets o C.4. Document Object Model Level 2 CSS o C.5. Document Object Model Level 2 Events o C.6. Document Object Model Level 2 Filters and Iterators o C.7. Document Object Model Level 2 Range * Appendix D: Java Language Binding o D.1. Document Object Model Level 2 Core o D.2. Document Object Model Level 2 Namespaces o D.3. Document Object Model Level 2 Stylesheets o D.4. Document Object Model Level 2 CSS o D.5. Document Object Model Level 2 Events o D.6. Document Object Model Level 2 Filters and Iterators o D.7. Document Object Model Level 2 Range * Appendix E: ECMA Script Language Binding o E.1. Document Object Model Level 2 Core o E.2. Document Object Model Level 2 Namespaces o E.3. Document Object Model Level 2 Stylesheets o E.4. Document Object Model Level 2 CSS o E.5. Document Object Model Level 2 Events o E.6. Document Object Model Level 2 Filters and Iterators o E.7. Document Object Model Level 2 Range * References * Index Copyright Notice Copyright © 1999 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. Documents on the W3C site are provided by the copyright holders under the following license. By obtaining, using and/or copying this document, or the W3C document from which this statement is linked, you agree that you have read, understood, and will comply with the following terms and conditions: Permission to use, copy, and distribute the contents of this document, or the W3C document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use: 1. A link or URI to the original W3C document. 2. The pre-existing copyright notice of the original author, if it doesn't exist, a notice of the form: "Copyright © World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved." 3. If it exists, the STATUS of the W3C document. When space permits, inclusion of the full text of this NOTICE should be provided. In addition, credit shall be attributed to the copyright holders for any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof. No right to create modifications or derivatives is granted pursuant to this license. THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to this document or its contents without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders. 1. Document Object Model (Core) Level 2 Editors Arnaud Le Hors, W3C 1.1. Overview of the DOM Level 2 Core Interfaces This section defines a set of extensions to the interfaces defined in the Core section of the DOM Level 1 Recommendation to provide functionalities which are found to be essential but were not addressed in DOM Level 1. These functionalitites include: * Creating a Document object * Copying a node from one document to another * A way to get the element an attribute is attached to (ED: Although new methods and attributes are introduced in this draft through the definition of a set of new interfaces, they are really meant to be added to the DOM Level 1 interfaces. The next version of this document will make this clear.) 1.2. The Core Interfaces Interface DocumentType2 Two new attributes are added to the DocumentType interface to provide a way for retrieving the public and system identifiers IDL Definition interface DocumentType2 : DocumentType { readonly attribute DOMString publicID; readonly attribute DOMString systemID; }; Attributes publicID The public identifier of the document type. systemID The system identifier of the document type. Interface DOMImplementation2 The DOMImplementation interface is extended with methods for creating an XML document instance. IDL Definition interface DOMImplementation2 : DOMImplementation { DocumentType createDocumentType(in DOMString name, in DOMString publicID, in DOMString systemID) raises(DOMException); Document createDocument(in DOMString name, in DocumentType doctype) raises(DOMException); }; Methods createDocumentType Creates an empty DocumentType node. Parameters name The document type name. publicID The document type public identifier. systemID The document type system identifier. Return Value A new DocumentType node with Node.ownerDocument set to null. Exceptions DOMException NOT_SUPPORTED_ERR: Raised if the requested document type is not supported. createDocument Creates an XML Document object of the specified type with its document element. (ED: Depending on how namespaces are supported this method may need one more parameter to hold the namespace name.) Parameters name The name of document element to be created. doctype The type of document to be created or null. When doctype is not null, its Node.ownerDocument attribute is set to the document being created. Return Value A new Document object. Exceptions DOMException WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document. NOT_SUPPORTED_ERR: Raised if the requested document type is not supported. Interface Document2 The Document interface is extended with a method for importing nodes from another document. IDL Definition interface Document2 : Document { Node importNode(in Node importedNode, in boolean deep); }; Methods importNode Imports a node from another document to this document. 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 and namespaces URI). As in the Node.cloneNode() operation, the source node is not altered. Additional information is copied as appropriate to the nodeType, attempting to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have different DTDs in the XML case. The following list describes the specifics for every type of node. ELEMENT_NODE Specified attributes 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 importNode's "deep" option was set True, the descendents of the the source element will be recursively imported and the resulting nodes reassembled to form the corresponding subtree. ATTRIBUTE_NODE The specified flag is set false on the generated Attr. The descendents of the the source Attr are recursively imported and the resulting nodes reassembled to form the corresponding subtree.Note that the deep parameter does not apply to Attr nodes, they always carry their children with them when imported. TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE These three types of nodes inheriting from CharacterData copy their data and length attributes from those of the source node. ENTITY_REFERENCE_NODE Only the EntityReference itself is copied, even if a deep import was requested, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned. ENTITY_NODE Entity nodes cannot be imported. PROCESSING_INSTRUCTION_NODE The imported node copies its target and data values from those of the source node. DOCUMENT_NODE Document nodes cannot be imported. DOCUMENT_TYPE_NODE DocumentType nodes cannot be imported. DOCUMENT_FRAGMENT_NODE If the deep option was set true, the descendents of the the source element will be recursively imported and the resulting nodes reassembled to form the corresponding subtree. Otherwise, this simply generates an empty DocumentFragment. NOTATION_NODE Notation nodes cannot be imported. Parameters importedNode The node to import. deep If true, recursively import the subtree under the specified node; if false, import only the node itself, as explained above. This does not apply to Attr and EntityReference nodes. Return Value The imported node that belongs to this Document. This method raises no exceptions. Interface Node2 The Node interface is extended with an additional method to test if it supports a specific feature. IDL Definition interface Node2 : Node { boolean supports(in DOMString feature, in DOMString version); }; Methods supports Tests whether the DOM implementation implements a specific feature and that feature is supported by this node. Parameters feature The package name of the feature to test. This is the same name as what can be passed to the method hasFeature on DOMImplementation. version This is the version number of the package name to test. In Level 2, version 1, this is the string "2.0". If the version is not specified, supporting any version of the feature will cause the method to return true. Return Value Returns true if this node defines a subtree within which the specified feature is supported, false otherwise. This method raises no exceptions. Interface Attr2 The Attr interface provides an additional method for accessing the Element node the attribute is attached to. IDL Definition interface Attr2 : Attr { readonly attribute Element ownerElement; }; Attributes ownerElement The Element node this attribute is attached to or null if this attribute is not in use. 1.3. The HTML Interfaces (ED: This interface is not actually part of the DOM Core. It is part of HTML DOM Level 2. The next version of this document will make this clear.) Interface HTMLDOMImplementation The HTMLDOMImplementation interface extends the DOMImplementation interface with a method for creating an HTML document instance. IDL Definition interface HTMLDOMImplementation : DOMImplementation { HTMLDocument createHTMLDocument(in DOMString title); }; Methods createHTMLDocument Creates an HTMLDocument object with the minimal tree made of the following elements: HTML, HEAD, TITLE, and BODY. Parameters title The title of the document to be set as the content of the TITLE element, through a child Text node. Return Value A new HTMLDocument object. This method raises no exceptions. 1.4. Open Issues 1. Should import of an ENTITY_NODE be supported? 2. Should import of an DOCUMENT_NODE be supported? 3. Should import of an DOCUMENT_TYPE_NODE be supported? 4. Should import of an NOTATION_NODE be supported? 5. Should we add a flag to importNode to request for removal of the source node? This would potentially allow implementations to optimize the operation by doing an actual move underneath when possible. 2. Document Object Model Namespaces Editors Arnaud Le Hors, W3C 2.1. Introduction This section defines two possible solutions to support XML namespaces. The first option consists in augmenting the interfaces defined in the Core section, leaving the semantics of DOM Level 1 as it is. The second option, on the contrary, consists in changing the semantics of DOM Level 1 and only augmenting existing interfaces where strictly necessary. In any case, support for namespaces is mandatory. (ED: Eventually only one of these two options will remain. But which one is still to be decided.) (ED: This section defines a set of new interfaces but their methods and attributes are actually meant to be added to the corresponding DOM Level 1 interface. The next version of this specification will make that clear.) 2.2. The Namespaces related Interfaces Option #1 Interface NodeNS The Node interface is extended to include a set of attributes to access the namespace prefix and namespace name of a node, and the local part of its qualified name (also called "local name" in this document). IDL Definition interface NodeNS { readonly attribute DOMString namespaceName; attribute DOMString prefix; // raises(DOMException) on setting readonly attribute DOMString localName; }; Attributes namespaceName Returns the namespace name of this node or null if it is unspecified. This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace name given at creation time. For nodes created with a DOM Level 1 method, such as Document.createElement, this is null. prefix The namespace prefix of this node or null if it is unspecified. For nodes created with a DOM Level 1 method, such as Document.createElement, this is null. Note that setting this attribute changes the nodeName attribute, which holds the qualified name, as well as the Element.tagName and Attr.name attributes when applicable. Exceptions on setting DOMException INVALID_CHARACTER_ERR: Raised if the specified prefix contains an invalid character. localName Returns the local part of the qualified name of this node. For nodes created with a DOM Level 1 method, such as Document.createElement, this is the same as Node.nodeName. Interface DocumentNS The Document interface provides two new methods for creating XML elements and attributes with a namespace prefix and namespace name. IDL Definition interface DocumentNS { Element createElementNS(in DOMString namespaceName, in DOMString qualifiedName) raises(DOMException); Attr createAttributeNS(in DOMString namespaceName, in DOMString qualifiedName) raises(DOMException); NodeList getElementsByTagNameNS(in DOMString namespaceName, in DOMString localName); }; Methods createElementNS Creates an element of the given qualified name and namespace name. Parameters namespaceName The namespace name of the element to create. qualifiedName The qualified name of the element type to instantiate. This can contain a namespace prefix. Return Value A new Element object with the following attributes: Attribute Value Node.nodeName qualifiedName Node.namespaceNamenamespaceName Node.prefix prefix, extracted from qualifiedName, or null if there is no prefix Node.localName local part, extracted from qualifiedName Element.tagName qualifiedName Exceptions DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. createAttributeNS Creates an attribute of the given qualified name and namespace name. Parameters namespaceName The namespace name of the attribute to create. qualifiedName The qualified name of the attribute to instantiate. This can contain a namespace prefix. Return Value A new Attr object with the following attributes: Attribute Value Node.nodeName qualifiedName Node.namespaceNamenamespaceName Node.prefix prefix, extracted from qualifiedName, or null if there is no prefix Node.localName local part, extracted from qualifiedName Attr.name qualifiedName Exceptions DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. getElementsByTagNameNS Returns a NodeList of all the Elements with a given local name and namespace name in the order in which they would be encountered in a preorder traversal of the Document tree. Parameters namespaceName The namespace name of the elements to match on. The special value "*" matches all namespaces. localName The local name of the elements to match on. The special value "*" matches all local names. Return Value A new NodeList object containing all the matched Elements. This method raises no exceptions. Interface ElementNS The Element interface is extended to provides a set of methods to manipulate attributes with namespaces. Note: Both the tagName attribute from the Element interface and the nodeName attribute from the Node interface return the qualified name. IDL Definition interface ElementNS { DOMString getAttributeNS(in DOMString namespaceName, in DOMString localName); void setAttributeNS(in DOMString namespaceName, in DOMString localName, in DOMString value) raises(DOMException); void removeAttributeNS(in DOMString namespaceName, in DOMString localName) raises(DOMException); Attr getAttributeNodeNS(in DOMString namespaceName, in DOMString localName); Attr setAttributeNodeNS(in Attr newAttr) raises(DOMException); NodeList getElementsByTagNameNS(in DOMString namespaceName, in DOMString localName); }; Methods getAttributeNS Retrieves an attribute value by name and namespace name. Parameters namespaceName The namespace name of the attribute to retrieve. localName The local name of the attribute to retrieve. Return Value The Attr value as a string, or an empty string if that attribute does not have a specified or default value. This method raises no exceptions. setAttributeNS Adds a new attribute. If an attribute with that local name and namespace name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNodeNS or setAttributeNode to assign it as the value of an attribute. Parameters namespaceName The namespace name of the attribute to create or alter. localName The local name of the attribute to create or alter. value The value to set in string form. Exceptions DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. This method returns nothing. removeAttributeNS Removes an attribute by local name and namespace name. If the removed attribute has a default value it is immediately replaced. Parameters namespaceName The namespace name of the attribute to remove. localName The local name of the attribute to remove. Exceptions DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. This method returns nothing. getAttributeNodeNS Retrieves an Attr node by name and namespace name. Parameters namespaceName The namespace name of the attribute to retreive. localName The local name of the attribute to retrieve. Return Value The Attr node with the specified attribute local name and namespace name or null if there is no such attribute. This method raises no exceptions. setAttributeNodeNS Adds a new attribute. If an attribute with that local name and namespace name is already present in the element, it is replaced by the new one. Parameters newAttr The Attr node to add to the attribute list. Return Value If the newAttr attribute replaces an existing attribute with the same local name and namespace name, the previously existing Attr node is returned, otherwise null is returned. Exceptions DOMException WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another ElementNS object. The DOM user must explicitly clone Attr nodes to re-use them in other elements. getElementsByTagNameNS Returns a NodeList of all the Elements with a given local name and namespace name in the order in which they would be encountered in a preorder traversal of the Document tree, starting from this node. Parameters namespaceName The namespace name of the elements to match on. The special value "*" matches all namespaces. localName The local name of the elements to match on. The special value "*" matches all local names. Return Value A new NodeList object containing all the matched Elements. This method raises no exceptions. 2.3. Further Considerations about Namespaces and Option #1 Special attributes used for declaring XML namespaces are exposed through the DOM and can be manipulated just like any other attribute. Moving a node within a document, using the DOM, in no case results in a change of its namespace prefix or namespace name. Similarly, creating a node with a namespace prefix and namespace name, or changing the namespace prefix of a node, does not result in any addition, removal, or modification of any special attributes for declaring the appropriate XML namespaces. Applications are therefore responsible for declaring every namespace in use when saving a document into XML. Elements and attributes can still be created using the createElement and createAttribute methods from the Document interface. However, they do not have any namespace prefix or namespace name then. This option garantees full backwards compatibility with DOM Level 1, however, it introduces a whole set of new interfaces and obsoletes a large swath of the Level 1 API which simply cannot be used by a namespace aware application. 2.4. The Namespaces Support Option #2 The solution described in this section is based on the use of "universal names". Universal names are made of the namespace name and the local name. Although there isn't currently any standard syntax for such names the following has been proposed: {namespaceName}localName. Assuming such names exist, supporting Namespaces can then simply be achieved by changing the DOM Level 1 semantics so that wherever an element or attribute name is taken in argument, if it is a universal name, namespace special handling is thrown into gear. Interface NodeNS The Node interface is extended to include a set of attributes to access the namespace prefix and namespace name of a node, and the local part of its qualified name (also called "local name" in this document). (ED: This is the same as in Option #1 with the additional universalName attribute.) IDL Definition interface NodeNS { readonly attribute DOMString universalName; readonly attribute DOMString namespaceName; attribute DOMString prefix; // raises(DOMException) on setting readonly attribute DOMString localName; }; Attributes universalName Returns the universal name of this node. namespaceName Returns the namespace name of this node or null if it is unspecified. This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace name given at creation time. prefix The namespace prefix of this node or null if it is unspecified. Note that setting this attribute changes the nodeName attribute, which holds the qualified name, as well as the Element.tagName and Attr.name attributes when applicable. Exceptions on setting DOMException INVALID_CHARACTER_ERR: Raised if the specified prefix contains an invalid character. localName Returns the local part of the qualified name of this node. Definition group Document changes The following methods of the Document interface are changed. Methods createElement Creates an element of the type specified. Parameters universalName The universal name of the element type to instantiate. For XML, this is case-sensitive. For HTML, the universalName parameter is simply the tagName and it may be provided in any case, but it must be mapped to the canonical uppercase form by the DOM implementation. This does not set the prefix which may be defined later through the Node.prefix attribute. Return Value A new Element object with the following attributes: Attribute Value Node.nodeName qualified name, initialized with the local part extracted from universalName Node.namespaceNamenamespaceName, extracted from universalName Node.prefix null Node.localName local part, extracted from universalName Element.tagName qualified name, initialized with the local part extracted from universalName Exceptions DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. createAttribute Creates an Attr of the given name. The returned object implements the Attr interface as well as the Node interface. It can then be set on an Element using the setAttributeNode method. This does not set the prefix which may be defined later through the Node.prefix attribute. Parameters universalName The universal name of the attribute. For HTML, this is simply the attribute name. Return Value A new Attr object with the following attributes: Attribute Value Node.nodeName qualified name, initialized with the local part extracted from universalName Node.namespaceNamenamespaceName, extracted from universalName Node.prefix null Node.localName local part, extracted from universalName Attr.name qualified name, initialized with the local part extracted from universalName Exceptions DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. getElementsByTagName Returns a NodeList of all the Elements with a given universal name in the order in which they would be encountered in a preorder traversal of the Document tree. Parameters universalName The universal name of the elements to match on. The special value "*" can be used to match all namespaces and/or local names. Return Value A new NodeList object containing all the matched Elements. This method raises no exceptions. Definition group Element changes The following methods of the Element interface are changed. Methods getAttribute Retrieves an attribute value by universal name. Parameters universalName The universal name of the attribute to retrieve. Return Value The Attr value as a string, or the empty string if that attribute does not have a specified or default value. This method raises no exceptions. setAttribute Adds a new attribute. If an attribute with that universal name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNode to assign it as the value of an attribute. Parameters universalName The universal name of the attribute to create or alter. value Value to set in string form. Exceptions DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. This method returns nothing. removeAttribute Removes an attribute by universal name. If the removed attribute has a default value it is immediately replaced. Parameters universalName The universal name of the attribute to remove. Exceptions DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. This method returns nothing. getAttributeNode Retrieves an Attr node by universal name. Parameters universalName The universal name of the attribute to retrieve. Return Value The Attr node with the specified attribute universal name or null if there is no such attribute. This method raises no exceptions. setAttributeNode Adds a new attribute. If an attribute with that universal name is already present in the element, it is replaced by the new one. Parameters newAttr The Attr node to add to the attribute list. Return Value If the newAttr attribute replaces an existing attribute with the same universal name, the previously existing Attr node is returned, otherwise null is returned. Exceptions DOMException WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements. getElementsByTagName Returns a NodeList of all the Elements with a given universal name in the order in which they would be encountered in a preorder traversal of the Document tree, starting from this node. Parameters universalName The universal name of the elements to match on. The special value "*" can be used to match all namespaces and/or local names. Return Value A new NodeList object containing all the matched Elements. This method raises no exceptions. 2.5. Further Considerations about Option #2 The model is the same as in Option #1, the difference only lies in the way we define access to the namespace information. The Option #2 has the obvious advantage of requiring only one new interface and very little change to make an application namespace aware. However, this is done at the cost of introducing some backwards incompatibility. Namely what is considered to be an error in DOM Level 1, now simply throw into gear some special handling of namespaces. In particular, while a DOM Level 1 implementation raises an INVALID_CHARACTER_ERR DOMException when "{myuri}foo" is passed to Document.createElement, a DOM Level 2 implementation would not. A DOM Level 1 application relying on this exception to be raised would therefore fail on a DOM Level 2 implementation. Here is a specific scenario where changing the behavior of the Level 1 DOM would adversely impact an application. Consider an editor application authored using the Level 1 DOM that allows a user to construct XML documents. One function of the editor allows the user to create elements in the DOM tree. The user enters the tag name through a UI that accepts the name of the tag, then calls Document.createElement to create an element node and then inserts the node into the tree using additional DOM methods (specifics are not req'd here). The editor allows the user to save the document to disk through a menu item in the editor. The save function is implemented using the Level 1 DOM. Basically, the save function walks the tree writing out the XML. For each element, it uses either the Node.nodeName or Element.tagName property to get the name of the element to output. Now, consider the same editor running under a Level 2 DOM implementation (note that the editor has not been re-authored for Level 2 DOM). The user agains begin creating elements in the DOM tree, however the user enters a valid universal name into the editor which in turn calls Document.createElement(). Since createElement() now accepts a universal name in Level 2, this succeeds whereas it would have failed in Level 1. The problems arises when the user tells the editor to save the document. As the save function walks the tree to output the XML, data loss occurs because in Level 1 there was no concept of namespaces. Therefore, Node.nodeName or Element.tagName return only the localName without the namespace. A code example for the scenario is: function buildElement(tagName,parent) { parent.appendChild(document.createElement(tagName)); } function saveTree(root) { switch (root.nodeType) { case Element: print("<" + root.nodeName + ">"); for (i = 0 ; i < root.childNodes.length ; i++) saveTree(root.childNodes.item(i)); print(""); break; // add more processing for other node types ... } } The call sequence for Level 1 DOM would be: // foo entered by user buildElement("foo",document.root); saveTree(document.root); The result would be: The call sequence for Level 2 DOM would be: // universal name entered by user buildElement("{http://somedomain/foonamespace}foo",document.root); saveTree(document.root); The result would be: which is not the desired result. 2.6. Open Issues 1. Which option do we choose?!! 2. Is the name "localName" ok? The namespaces spec uses "localPart" but it doesn't seem descriptive enough. We could make it "localPartName". We need to sync with XSL. 3. getElementsByTagname is a misnommer when used with namespaces, should we use another name?!! If yes, which one? getElementsByName? 3. Document Object Model StyleSheets Editors Vidur Apparao, Netscape Communications Corp. Philippe Le Hégaret, W3C Chris Wilson, Microsoft 3.1. Introduction The DOM Level 2 Style Sheet interfaces are base interfaces used to represent any type of style sheet. The expectation is that DOM modules that represent a specific style sheet language may contain interfaces that derive from these interfaces. 3.2. Style Sheet Interfaces This set of interfaces represents the generic notion of style sheets. Interface StyleSheet The StyleSheet interface is the abstract base interface for any type of style sheet. It represents a single style sheet associated with a structured document. In HTML, the StyleSheet interface represents either an external style sheet, included via the HTML LINK element, or an inline STYLE element. In XML, this interface represents an external style sheet, included via a style sheet processing instruction . IDL Definition interface StyleSheet { readonly attribute DOMString type; attribute boolean disabled; readonly attribute Node ownerNode; readonly attribute StyleSheet parentStyleSheet; readonly attribute DOMString href; readonly attribute DOMString title; readonly attribute MediaList media; }; Attributes type This specifies the style sheet language for this style sheet. The style sheet language is specified as a content type (e.g. "text/css"). The content type is often specified in the ownerNode. A list of registered content types can be found at ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/. Also see the type attribute definition for the LINK element in HTML 4.0, and the type pseudo-attribute for the XML style sheet processing instruction . disabled false if the style sheet is applied to the document. true if it is not. Modifying this attribute may cause a reresolution of style for the document. ownerNode The node that associates this style sheet with the document. For HTML, this may be the corresponding LINK or STYLE element. For XML, it may be the linking processing instruction. For style sheets that are included by other style sheets, this attribute has a value of null. parentStyleSheet For style sheet languages that support the concept of style sheet inclusion, this attribute represents the including style sheet, if one exists. If the style sheet is a top-level style sheet, or the style sheet language does not support inclusion, the value of the attribute is null. href If the style sheet is a linked style sheet, the value of its attribute is its location. For inline style sheets, the value of this attribute is null. See the href attribute definition for the LINK element in HTML 4.0, and the href pseudo-attribute for the XML style sheet processing instruction . title The advisory title. The title is often specified in the ownerNode. See the title attribute definition for the LINK element in HTML 4.0, and the title pseudo-attribute for the XML style sheet processing instruction . media The intended destination media for style information. The media is often specified in the ownerNode. See the media attribute definition for the LINK element in HTML 4.0, and the media pseudo-attribute for the XML style sheet processing instruction . Interface StyleSheetList The StyleSheetList interface provides the abstraction of an ordered collection of style sheets. IDL Definition interface StyleSheetList { readonly attribute unsigned long length; StyleSheet item(in unsigned long index); }; Attributes length The number of StyleSheet in the list. The range of valid child stylesheet indices is 0 to length-1 inclusive. Methods item Used to retrieve a style sheet by ordinal index. Parameters index Index into the collection Return Value The style sheet at the index position in the StyleSheetList, or null if that is not a valid index. This method raises no exceptions. Interface MediaList The MediaList interface provides the abstraction of an ordered collection of media, without defining or constraining how this collection is implemented. All media are lowercase strings. IDL Definition interface MediaList { attribute DOMString cssText; // raises(DOMException) on setting readonly attribute unsigned long length; DOMString item(in unsigned long index); void delete(in DOMString oldMedium) raises(DOMException); void append(in DOMString newMedium) raises(DOMException); }; Attributes cssText The parsable textual representation of the media list. This is a comma-separated list of media. Exceptions on setting DOMException SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is readonly. length The number of media in the list. The range of valid media is 0 to length-1 inclusive. Methods item Returns the indexth in the list. If index is greater than or equal to the number of media in the list, this returns null. Parameters index Index into the collection. Return Value The medium at the indexth position in the MediaList, or null if that is not a valid index. This method raises no exceptions. delete Deletes the medium indicated by oldMedium from the list. Parameters oldMedium The medium to delete in the media list. Exceptions DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly. NOT_FOUND_ERR: Raised if oldMedium is not in the list. This method returns nothing. append Adds the medium newMedium to the end of the list. It the newMedium is already used, it is first removed. Parameters newMedium The new medium to add. Exceptions DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly. This method returns nothing. 3.3. Document Extensions Interface DocumentStyle The DocumentStyle interface provides a mechanism by which the style sheets embedded a document can be retrieved. The expectation is that an instance of the DocumentStyle interface can be obtained by using binding-specific casting methods on an instance of the Level 1 Document interface. IDL Definition interface DocumentStyle { readonly attribute StyleSheetList styleSheets; }; Attributes styleSheets 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. 4. Document Object Model CSS Editors Vidur Apparao, Netscape Communications Corp. Philippe Le Hégaret, W3C Chris Wilson, Microsoft 4.1. Overview of the DOM Level 2 CSS Interfaces The DOM Level 2 Cascading Style Sheets (CSS) interfaces are designed with the goal of exposing CSS constructs to object model consumers. Cascading Style Sheets is a declarative syntax for defining presentation rules, properties and ancillary constructs used to format and render Web documents. This document specifies a mechanism to programmatically access and modify the rich style and presentation control provided by CSS (specifically CSS level two). This augments CSS by providing a mechanism to dynamically control the inclusion and exclusion of individual style sheets, as well as manipulate CSS rules and properties. The CSS interfaces are organized in a logical, rather than physical structure. A collection of all style sheets referenced by or embedded in the document is accessible on the document interface. Each item in this collection exposes the properties common to all style sheets referenced or embedded in HTML and XML documents; this interface is described in the Style Sheets chapter of the DOM Level 2. User style sheets are not accessible through this collection, in part due to potential privacy concerns (and certainly read-write issues). For each CSS style sheet, an additional interface is exposed - the CSSStyleSheet interface. This interface allows access to the collection of rules within a CSS style sheet and methods to modify that collection. Interfaces are provided for each specific type of rule in CSS2 (e.g. style declarations, @import rules, or @font-face rules), as well as a shared generic CSSRule interface. The most common type of rule is a style declaration. The CSSStyleRule interface that represents this type of rule provides string access to the CSS selector of the rule, and access to the property declarations through the CSSStyleDeclaration interface. Finally, an optional CSS2Properties interface is described; this interface (if implemented) provides shortcuts to the string values of all the properties in CSS level 2. 4.2. CSS Fundamental Interfaces The interfaces within this section are considered fundamental, and must be implemented by all conforming applications of this specifcation. These interfaces represent CSS style sheets specifically. A DOM consumer can use the hasFeature of the DOMImplementation interface to determine whether the CSS module has been implemented by a DOM implementation. The feature string for the fundamental interfaces listed in this section is "CSS". Interface CSSStyleSheet The CSSStyleSheet interface is a concrete interface used to represent a CSS style sheet i.e. a style sheet whose content type is "text/css". IDL Definition interface CSSStyleSheet : StyleSheet { readonly attribute CSSRule ownerRule; readonly attribute CSSRuleList cssRules; unsigned long insertRule(in DOMString rule, in unsigned long index) raises(DOMException); void deleteRule(in unsigned long index) raises(DOMException); }; Attributes ownerRule If this style sheet comes from an @import rule, the ownerRule attribute will contain the CSSImportRule. In that case, the ownerNode attribute in the StyleSheet interface will be null. If the style sheet comes from an element or a processing instruction, the ownerRule attribute will be null and the ownerNode attribute will contain the Node. cssRules The list of all CSS rules contained within the style sheet. This includes both rule sets and at-rules. Methods insertRule Used to insert a new rule into the style sheet. The new rule now becomes part of the cascade. Parameters rule The parsable text representing the rule. For rule sets this contains both the selector and the style declaration. For at-rules, this specifies both the at-identifier and the rule content. index The index within the style sheet's rule list of the rule before which to insert the specified rule. If the specified index is equal to the length of the style sheet's rule collection, the rule will be added to the end of the style sheet. Return Value The index within the style sheet's rule collection of the newly inserted rule. Exceptions DOMException HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the specified index e.g. if an @import rule is inserted after a standard rule set or other at-rule. INDEX_SIZE_ERR: Raised if the specified index is not a valid insertion point. SYNTAX_ERR: Raised if the specified rule has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is readonly. deleteRule Used to delete a rule from the style sheet. Parameters index The index within the style sheet's rule list of the rule to remove. Exceptions DOMException INDEX_SIZE_ERR: Raised if the specified index does not correspond to a rule in the style sheet's rule list. NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is readonly. This method returns nothing. Interface CSSRuleList The CSSRuleList interface provides the abstraction of an ordered collection of CSS rules. IDL Definition interface CSSRuleList { readonly attribute unsigned long length; CSSRule item(in unsigned long index); }; Attributes length The number of CSSRules in the list. The range of valid child rule indices is 0 to length-1 inclusive. Methods item Used to retrieve a CSS rule by ordinal index. The order in this collection represents the order of the rules in the CSS style sheet. Parameters index Index into the collection Return Value The style rule at the index position in the CSSRuleList, or null if that is not a valid index. This method raises no exceptions. Interface CSSRule The CSSRule interface is the abstract base interface for any type of CSS statement. This includes both rule sets and at-rules. An implementation is expected to preserve all rules specified in a CSS style sheet, even if it is not recognized. Unrecognized rules are represented using the CSSUnknownRule interface. IDL Definition interface CSSRule { // RuleType const unsigned short UNKNOWN_RULE = 0; const unsigned short STYLE_RULE = 1; const unsigned short CHARSET_RULE = 2; const unsigned short IMPORT_RULE = 3; const unsigned short MEDIA_RULE = 4; const unsigned short FONT_FACE_RULE = 5; const unsigned short PAGE_RULE = 6; readonly attribute unsigned short type; attribute DOMString cssText; // raises(DOMException) on setting readonly attribute CSSStyleSheet parentStyleSheet; readonly attribute CSSRule parentRule; }; Definition group RuleType An integer indicating which type of rule this is. Defined Constants UNKNOWN_RULE The rule is a CSSUnknownRule. STYLE_RULE The rule is a CSSStyleRule. CHARSET_RULE The rule is a CSSCharsetRule. IMPORT_RULE The rule is a CSSImportRule. MEDIA_RULE The rule is a CSSMediaRule. FONT_FACE_RULE The rule is a CSSFontFaceRule. PAGE_RULE The rule is a CSSPageRule. Attributes type The type of the rule, as defined above. The expectation is that binding-specific casting methods can be used to cast down from an instance of the CSSRule interface to the specific derived interface implied by the type. cssText The parsable textual representation of the rule. This reflects the current state of the rule and not its initial value. Exceptions on setting DOMException SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable. HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at this point in the style sheet. NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is readonly. parentStyleSheet The style sheet that contains this rule. parentRule If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns null. Interface CSSStyleRule The CSSStyleRule interface represents a single rule set in a CSS style sheet. IDL Definition interface CSSStyleRule : CSSRule { attribute DOMString selectorText; // raises(DOMException) on setting readonly attribute CSSStyleDeclaration style; }; Attributes selectorText The textual representation of the selector for the rule set. The implementation may have stripped out insignificant whitespace while parsing the selector. Exceptions on setting DOMException SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is readonly. style The declaration-block of this rule set. Interface CSSMediaRule The CSSMediaRule interface represents a @media rule in a CSS style sheet. A @media rule can be used to delimit style rules for specific media types. IDL Definition interface CSSMediaRule : CSSRule { readonly attribute MediaList media; readonly attribute CSSRuleList cssRules; unsigned long insertRule(in DOMString rule, in unsigned long index) raises(DOMException); void deleteRule(in unsigned long index) raises(DOMException); }; Attributes media A list of media types for this rule. cssRules A list of all CSS rules contained within the media block. Methods insertRule Used to insert a new rule into the media block. Parameters rule The parsable text representing the rule. For rule sets this contains both the selector and the style declaration. For at-rules, this specifies both the at-identifier and the rule content. index The index within the media block's rule collection of the rule before which to insert the specified rule. If the specified index is equal to the length of the media blocks's rule collection, the rule will be added to the end of the media block. Return Value The index within the media block's rule collection of the newly inserted rule. Exceptions DOMException HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the specified index. e.g. if an @import rule is inserted after a standard rule set or other at-rule. INDEX_SIZE_ERR: Raised if the specified index is not a valid insertion point. SYNTAX_ERR: Raised if the specified rule has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is readonly. deleteRule Used to delete a rule from the media block. Parameters index The index within the media block's rule collection of the rule to remove. Exceptions DOMException INDEX_SIZE_ERR: Raised if the specified index does not correspond to a rule in the media rule list. NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is readonly. This method returns nothing. Interface CSSFontFaceRule The CSSFontFaceRule interface represents a @font-face rule in a CSS style sheet. The @font-face rule is used to hold a set of font descriptions. IDL Definition interface CSSFontFaceRule : CSSRule { readonly attribute CSSStyleDeclaration style; }; Attributes style The declaration-block of this rule. Interface CSSPageRule The CSSPageRule interface represents a @page rule within a CSS style sheet. The @page rule is used to specify the dimensions, orientation, margins, etc. of a page box for paged media. IDL Definition interface CSSPageRule : CSSRule { attribute DOMString selectorText; // raises(DOMException) on setting readonly attribute CSSStyleDeclaration style; }; Attributes selectorText The parsable textual representation of the page selector for the rule. Exceptions on setting DOMException SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is readonly. style The declaration-block of this rule. Interface CSSImportRule The CSSImportRule interface represents a @import rule within a CSS style sheet. The @import rule is used to import style rules from other style sheets. IDL Definition interface CSSImportRule : CSSRule { readonly attribute DOMString href; readonly attribute MediaList media; readonly attribute CSSStyleSheet styleSheet; }; Attributes href The location of the style sheet to be imported. The attribute will not contain the "url(...)" specifier around the URI. media A list of media types for which this style sheet may be used. styleSheet The style sheet referred to by this rule, if it has been loaded. The value of this attribute is null if the style sheet has not yet been loaded or if it will not be loaded (e.g. if the style sheet is for a media type not supported by the user agent). Interface CSSCharsetRule The CSSCharsetRule interface a @charset rule in a CSS style sheet. A @charset rule can be used to define the encoding of the style sheet. IDL Definition interface CSSCharsetRule : CSSRule { attribute DOMString encoding; // raises(DOMException) on setting }; Attributes encoding The encoding information used in this @charset rule. Exceptions on setting DOMException SYNTAX_ERR: Raised if the specified encoding value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this encoding rule is readonly. Interface CSSUnknownRule The CSSUnkownRule interface represents an at-rule not supported by this user agent. IDL Definition interface CSSUnknownRule : CSSRule { }; Interface CSSStyleDeclaration The CSSStyleDeclaration interface represents a single CSS declaration block. This interface may be used to determine the style properties currently set in a block or to set style properties explicitly within the block. While an implementation may not recognize all CSS properties within a CSS declaration block, it is expected to provide access to all specified properties through the CSSStyleDeclaration interface. Furthermore, implementations that support a specific level of CSS should correctly handle CSS shorthand properties for that level. For a further discussion of shorthand properties, see the CSS2Properties interface. IDL Definition interface CSSStyleDeclaration { attribute DOMString cssText; // raises(DOMException) on setting DOMString getPropertyValue(in DOMString propertyName); CSSValue getPropertyCSSValue(in DOMString propertyName); DOMString removeProperty(in DOMString propertyName) raises(DOMException); DOMString getPropertyPriority(in DOMString propertyName); void setProperty(in DOMString propertyName, in DOMString value, in DOMString priority) raises(DOMException); readonly attribute unsigned long length; DOMString item(in unsigned long index); readonly attribute CSSRule parentRule; }; Attributes cssText The parsable textual representation of the declaration block (including the surrounding curly braces). Setting this attribute will result in the parsing of the new value and resetting of the properties in the declaration block. Exceptions on setting DOMException SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly. length The number of properties that have been explicitly set in this declaration block. parentRule The CSS rule that contains this declaration block. Methods getPropertyValue Used to retrieve the value of a CSS property if it has been explicitly set within this declaration block. Parameters propertyName The name of the CSS property. See the CSS property index. Return Value Returns the value of the property if it has been explicitly set for this declaration block. Returns the empty string if the property has not been set. This method raises no exceptions. getPropertyCSSValue Used to retrieve the object representation of the value of a CSS property if it has been explicitly set within this declaration block. This method returns null if the property is a shorthand property. Shorthand property values can only be accessed and modified as strings, using the getPropertyValue and setProperty methods. Parameters propertyName The name of the CSS property. See the CSS property index. Return Value Returns the value of the property if it has been explicitly set for this declaration block. Returns the null if the property has not been set. This method raises no exceptions. removeProperty Used to remove a CSS property if it has been explicitly set within this declaration block. Parameters propertyName The name of the CSS property. See the CSS property index. Return Value Returns the value of the property if it has been explicitly set for this declaration block. Returns the empty string if the property has not been set or the property name does not correspond to a valid CSS2 property. Exceptions DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly. getPropertyPriority Used to retrieve the priority of a CSS property (e.g. the "important" qualifier) if the property has been explicitly set in this declaration block. Parameters propertyName The name of the CSS property. See the CSS property index. Return Value A string representing the priority (e.g. "important") if one exists. The empty string if none exists. This method raises no exceptions. setProperty Used to set a property value and priority within this declaration block. Parameters propertyName The name of the CSS property. See the CSS property index. value The new value of the property. priority The new priority of the property (e.g. "important"). Exceptions DOMException SYNTAX_ERR: Raised if the specified value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly. This method returns nothing. item Used to retrieve the properties that have been explicitly set in this declaration block. The order of the properties retrieved using this method does not have to be the order in which they were set. This method can be used to iterate over all properties in this declaration block. Parameters index Index of the property name to retrieve. Return Value The name of the property at this ordinal position. The empty string if no property exists at this position. This method raises no exceptions. Interface CSSValue The CSSValue interface represents a simple or a complexe value. IDL Definition interface CSSValue { // UnitTypes const unsigned short CSS_PRIMITIVE_VALUE = 0; const unsigned short CSS_VALUE_LIST = 1; const unsigned short CSS_CUSTOM = 2; attribute DOMString cssText; // raises(DOMException) on setting readonly attribute unsigned short valueType; }; Definition group UnitTypes An integer indicating which type of unit applies to the value. Note: All CSS2 constants are not supposed to be required by the implementation since all CSS2 interfaces are optionals. Defined Constants CSS_PRIMITIVE_VALUE The value is a CSSPrimitiveValue. CSS_VALUE_LIST The value is a list CSSValue. CSS_CUSTOM The value is a custom value. Attributes cssText A string representation of the current value. Exceptions on setting DOMException SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly. valueType A code defining the type of the value as defined above. Interface CSSPrimitiveValue The CSSPrimitiveValue interface represents a single CSS value. This interface may be used to determine the value of a specific style property currently set in a block or to set a specific style properties explicitly within the block. An instance of this interface can be obtained from the getPropertyCSSValue method of the CSSStyleDeclaration interface. IDL Definition interface CSSPrimitiveValue : CSSValue { // UnitTypes const unsigned short CSS_UNKNOWN = 0; const unsigned short CSS_INHERIT = 1; const unsigned short CSS_NUMBER = 2; const unsigned short CSS_PERCENTAGE = 3; const unsigned short CSS_EMS = 4; const unsigned short CSS_EXS = 5; const unsigned short CSS_PX = 6; const unsigned short CSS_CM = 7; const unsigned short CSS_MM = 8; const unsigned short CSS_IN = 9; const unsigned short CSS_PT = 10; const unsigned short CSS_PC = 11; const unsigned short CSS_DEG = 12; const unsigned short CSS_RAD = 13; const unsigned short CSS_GRAD = 14; const unsigned short CSS_MS = 15; const unsigned short CSS_S = 16; const unsigned short CSS_HZ = 17; const unsigned short CSS_KHZ = 18; const unsigned short CSS_DIMENSION = 19; const unsigned short CSS_STRING = 20; const unsigned short CSS_URI = 21; const unsigned short CSS_IDENT = 22; const unsigned short CSS_ATTR = 23; const unsigned short CSS_COUNTER = 24; const unsigned short CSS_RECT = 26; const unsigned short CSS_RGBCOLOR = 27; readonly attribute unsigned short primitiveType; void setFloatValue(in unsigned short unitType, in float floatValue) raises(DOMException); float getFloatValue(in unsigned short unitType) raises(DOMException); void setStringValue(in unsigned short stringType, in DOMString stringValue) raises(DOMException); DOMString getStringValue() raises(DOMException); Counter getCounterValue() raises(DOMException); Rect getRectValue() raises(DOMException); RGBColor getRGBColorValue() raises(DOMException); }; Definition group UnitTypes An integer indicating which type of unit applies to the value. Defined Constants The value is not a recognized CSS2 value. The CSS_UNKNOWN value can only be obtained by using the cssText attribute. The value is the inherit identifier. The CSS_INHERIT string representation of this value can be obtained by using the getStringValue method. The value is a simple number. The value can CSS_NUMBER be obtained by using the getFloatValue method. CSS_PERCENTAGE The value is a percentage. The value can be obtained by using the getFloatValue method. CSS_EMS The value is length (ems). The value can be obtained by using the getFloatValue method. CSS_EXS The value is length (exs). The value can be obtained by using the getFloatValue method. CSS_PX The value is length (px). The value can be obtained by using the getFloatValue method. CSS_CM The value is length (cm). The value can be obtained by using the getFloatValue method. CSS_MM The value is length (mm). The value can be obtained by using the getFloatValue method. CSS_IN The value is length (in). The value can be obtained by using the getFloatValue method. CSS_PT The value is length (pt). The value can be obtained by using the getFloatValue method. CSS_PC The value is a length (pc). The value can be obtained by using the getFloatValue method. CSS_DEG The value is an angle (deg). The value can be obtained by using the getFloatValue method. CSS_RAD The value is an angle (rad). The value can be obtained by using the getFloatValue method. The value is an angle (grad). The value can CSS_GRAD be obtained by using the getFloatValue method. CSS_MS The value is a time (ms). The value can be obtained by using the getFloatValue method. CSS_S The value is a time (s). The value can be obtained by using the getFloatValue method. The value is a frequency (Hz). The value can CSS_HZ be obtained by using the getFloatValue method. The value is a frequency (kHz). The value can CSS_KHZ be obtained by using the getFloatValue method. The value is a number with an unknown CSS_DIMENSION dimension. The value can be obtained by using the getFloatValue method. CSS_STRING The value is a STRING. The value can be obtained by using the getStringValue method. CSS_URI The value is a URI. The value can be obtained by using the getStringValue method. CSS_IDENT The value is an identifier. The value can be obtained by using the getStringValue method. The value is a attribute function. The value CSS_ATTR can be obtained by using the getStringValue method. The value is a counter or counters function. CSS_COUNTER The value can be obtained by using the getCounterValue method. CSS_RECT The value is a rect function. The value can be obtained by using the getRectValue method. The value is a RGB color. The value can be CSS_RGBCOLOR obtained by using the getRGBColorValue method. Attributes primitiveType The type of the value as defined by the constants specified above. Methods setFloatValue A method to set the float value with a specified unit. If the property attached with this value can not accept the specified unit or the float value, the value will be unchanged and a DOMException will be raised. Parameters unitType A unit code as defined above. The unit code can only be a float unit type (e.g. NUMBER, PERCENTAGE, CSS_EMS, CSS_EXS, CSS_PX, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC, CSS_DEG, CSS_RAD, CSS_GRAD, CSS_MS, CSS_S, CSS_HZ, CSS_KHZ, CSS_DIMENSION). floatValue The new float value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the attached property doesn't support the float value or the unit type. NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly. This method returns nothing. getFloatValue This method is used to get a float value in a specified unit. If this CSS value doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised. Parameters unitType A unit code to get the float value. The unit code can only be a float unit type (e.g. CSS_NUMBER, CSS_PERCENTAGE, CSS_EMS, CSS_EXS, CSS_PX, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC, CSS_DEG, CSS_RAD, CSS_GRAD, CSS_MS, CSS_S, CSS_HZ, CSS_KHZ, CSS_DIMENSION). Return Value The float value in the specified unit. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a float value or if the float value can't be converted into the specified unit. setStringValue A method to set the string value with a specified unit. If the property attached to this value can't accept the specified unit or the string value, the value will be unchanged and a DOMException will be raised. Parameters stringType A string code as defined above. The string code can only be a string unit type (e.g. CSS_URI, CSS_IDENT, CSS_INHERIT and CSS_ATTR). stringValue The new string value. If the stringType is equal to CSS_INHERIT, the stringValue should be inherit. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a string value or if the string value can't be converted into the specified unit. NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly. This method returns nothing. getStringValue This method is used to get the string value in a specified unit. If the CSS value doesn't contain a string value, a DOMException is raised. Return Value The string value in the current unit. The current valueType can only be a string unit type (e.g. CSS_URI, CSS_IDENT and CSS_ATTR). Exceptions DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a string value. This method has no parameters. getCounterValue This method is used to get the Counter value. If this CSS value doesn't contain a counter value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Counter interface. Return Value The Counter value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a Counter value. This method has no parameters. getRectValue This method is used to get the Rect value. If this CSS value doesn't contain a rect value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Rect interface. Return Value The Rect value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a Rect value. This method has no parameters. getRGBColorValue This method is used to get the RGB color. If this CSS value doesn't contain a RGB color value, a DOMException is raised. Modification to the corresponding style property can be achieved using the RGBColor interface. Return Value the RGB color value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the attached property can't return a RGB color value. This method has no parameters. Interface CSSValueList The CSSValueList interface provides the absraction of an ordered collection of CSS values. IDL Definition interface CSSValueList : CSSValue { readonly attribute unsigned long length; CSSValue item(in unsigned long index); }; Attributes length The number of CSSValues in the list. The range of valid values indices is 0 to length-1 inclusive. Methods item Used to retrieve a CSS rule by ordinal index. The order in this collection represents the order of the values in the CSS style property. Parameters index Index into the collection. Return Value The style rule at the index position in the CSSValueList, or null if that is not valid index. This method raises no exceptions. Interface RGBColor The RGBColor interface is used to represent any RGB color value. This interface reflects the values in the underlying style property. Hence, modifications made through this interface modify the style property. IDL Definition interface RGBColor { attribute CSSValue red; attribute CSSValue green; attribute CSSValue blue; }; Attributes red This attribute is used for the red value of the RGB color. green This attribute is used for the green value of the RGB color. blue This attribute is used for the blue value of the RGB color. Interface Rect The Rect interface is used to represent any rect value. This interface reflects the values in the underlying style property. Hence, modifications made through this interface modify the style property. IDL Definition interface Rect { attribute CSSValue top; attribute CSSValue right; attribute CSSValue bottom; attribute CSSValue left; }; Attributes top This attribute is used for the top of the rect. right This attribute is used for the right of the rect. bottom This attribute is used for the bottom of the rect. left This attribute is used for the left of the rect. Interface Counter The Counter interface is used to represent any counter or counters function value. This interface reflects the values in the underlying style property. Hence, modifications made through this interface modify the style property. IDL Definition interface Counter { attribute DOMString identifier; attribute DOMString listStyle; attribute DOMString separator; }; Attributes identifier This attribute is used for the identifier of the counter. listStyle This attribute is used for the style of the list. separator This attribute is used for the separator of nested counters. 4.3. CSS Extended Interfaces The interfaces found within this section are not mandatory. A DOM consumer can use the hasFeature of the DOMImplementation interface to determine whether the CSS2 extended interfaces have been implemented by a DOM implementation. The feature string for all the extended interfaces listed in this section except the CSS2Properties interface is "CSS2". The following table specifies the type of CSSValue used to represent each property that can be specified in a CSSStyleDeclaration found in a CSSStyleRule for a CSS Level 2 style sheet. The expectation is that the CSSValue returned from the getPropertyCSSValue method on the CSSStyleDeclaration interface can be cast down, using binding-specific casting methods, to the specific derived interface. For properties that are represented by a custom interface (the valueType of the CSSValue is CSS_CUSTOM), the name of the derived interface is specified in the table. For properties that consist of lists of values (the valueType of the CSSValue is CSS_VALUE_LIST), the derived interface is CSSValueList. For all other properties (the valueType of the CSSValue is CSS_PRIMITIVE_VALUE), the derived interface is CSSPrimitiveValue. Property Name Representation azimuth CSS2Azimuth background null background-attachment ident background-color rgbcolor, ident background-image uri, ident background-position CSS2BackgroundPosition background-repeat ident border null border-collapse ident border-color null border-spacing CSS2BorderSpacing border-style null border-top, border-right, null border-bottom, border-left border-top-color, rgbcolor, ident border-right-color, border-bottom-color, border-left-color border-top-style, ident border-right-style, border-bottom-style, border-left-style border-top-width, length, ident border-right-width, border-bottom-width, border-left-width border-width null bottom length, percentage, ident caption-side ident clear ident clip rect, ident color rgbcolor, ident content list of string, uri, counter, attr, ident counter-increment list of CSS2CounterIncrement counter-reset list of CSS2CounterReset cue null cue-after, cue-before uri, ident cursor CSS2Cursor direction ident display ident elevation angle, ident empty-cells ident float ident font null font-family list of strings and idents font-size ident, length, percentage font-size-adjust number, ident font-stretch ident font-style ident font-variant ident font-weight ident height length, percentage, ident left length, percentage, ident letter-spacing ident, length line-height ident, length, percentage, number list-style null list-style-image uri, ident list-style-position ident list-style-type ident margin null margin-top, margin-right, length, percentage, ident margin-bottom, margin-left marker-offset length, ident max-height length, percentage, ident max-width length, percentage, ident min-height length, percentage, ident min-width length, percentage, ident orphans number outline null outline-color rgbcolor, ident outline-style ident outline-width length, ident overflow ident padding null padding-top, padding-right, length, percentage padding-bottom, padding-left page ident page-break-after ident page-break-before ident page-break-inside ident pause null pause-after, pause-before time, percentage pitch frequency, identifier pitch-range number play-during CSS2PlayDuring position ident quotes list of string or ident richness number right length, percentage, ident speak ident speak-header ident speak-numeral ident speak-punctuation ident speech-rate number, ident stress number table-layout ident text-align ident, string text-decoration list of ident text-indent length, percentage text-shadow list of CSS2TextShadow text-transform ident top length, percentage, ident unicode-bidi ident vertical-align ident, percentage, length visibility ident voice-family list of strings and idents volume number, percentage, ident white-space ident widows number width length, percentage, ident word-spacing length, ident z-index ident, number Interface CSS2Azimuth The CSS2Azimuth interface represents the azimuth CSS Level 2 property. IDL Definition interface CSS2Azimuth : CSSValue { readonly attribute unsigned short azimuthType; readonly attribute DOMString identifier; readonly attribute boolean behind; void setAngleValue(in unsigned short unitType, in float floatValue) raises(DOMException); float getAngleValue(in unsigned short unitType) raises(DOMException); void setIdentifier(in DOMString identifier, in boolean behind) raises(DOMException); }; Attributes azimuthType A code defining the type of the value as defined in CSSValue. It would be one of CSS_DEG, CSS_RAD, CSS_GRAD or CSS_IDENT. identifier If azimuthType is CSS_IDENT, identifier contains one of left-side, far-left, left, center-left, center, center-right, right, far-right, right-side, leftwards, rightwards. The empty string if none is set. behind behind indicates whether the behind identifier has been set. Methods setAngleValue A method to set the angle value with a specified unit. This method will unset any previously set identifiers values. Parameters unitType The unitType could only be one of CSS_DEG, CSS_RAD or CSS_GRAD). floatValue The new float value of the angle. Exceptions DOMException INVALID_ACCESS_ERR: Raised if the unit type is invalid. NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly. This method returns nothing. getAngleValue Used to retrieved the float value of the azimuth property. Parameters unitType The unit type can be only an angle unit type (CSS_DEG, CSS_RAD or CSS_GRAD). Return Value The float value. Exceptions DOMException INVALID_ACCESS_ERR: Raised if the unit type is invalid. setIdentifier Setting the identifier for the azimuth property will unset any previously set angle value. The value of azimuthType is set to CSS_IDENT Parameters identifier The new identifier. If the identifier is "leftwards" or "rightward", the behind attribute is ignored. behind The new value for behind. Exceptions DOMException SYNTAX_ERR: Raised if the specified identifier has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly. This method returns nothing. Interface CSS2BackgroundPosition The CSS2BackgroundPosition interface represents the background-position CSS Level 2 property. IDL Definition interface CSS2BackgroundPosition : CSSValue { readonly attribute unsigned short horizontalType; readonly attribute unsigned short verticalType; readonly attribute DOMString horizontalIdentifier; readonly attribute DOMString verticalIdentifier; float getHorizontalPosition(in float horizontalType) raises(DOMException); float getVerticalPosition(in float verticalType) raises(DOMException); void setHorizontalPosition(in unsigned short horizontalType, in float value) raises(DOMException); void setVerticalPosition(in unsigned short verticalType, in float value) raises(DOMException); void setPositionIdentifier(in DOMString horizontalIdentifier, in DOMString verticalIdentifier) raises(DOMException); }; Attributes horizontalType A code defining the type of the horizontal value. It would be one CSS_PERCENTAGE, CSS_EMS, CSS_EXS, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC, CSS_IDENT, CSS_INHERIT. If one of horizontal or vertical is CSS_IDENT or CSS_INHERIT, it's guaranteed that the other is the same. verticalType A code defining the type of the horizontal value. The code can be one of the following units : CSS_PERCENTAGE, CSS_EMS, CSS_EXS, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC, CSS_IDENT, CSS_INHERIT. If one of horizontal or vertical is CSS_IDENT or CSS_INHERIT, it's guaranteed that the other is the same. horizontalIdentifier If horizontalType is CSS_IDENT or CSS_INHERIT, this attribute contains the string representation of the ident, otherwise it contains an empty string. verticalIdentifier If verticalType is CSS_IDENT or CSS_INHERIT, this attribute contains the string representation of the ident, otherwise it contains an empty string. The value is "center" if only the horizontalIdentifier has been set. The value is "inherit" if the horizontalIdentifier is "inherit". Methods getHorizontalPosition This method is used to get the float value in a specified unit if the horizontalPosition represents a length or a percentage. If the float doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised. Parameters horizontalType The specified unit. Return Value The float value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the property doesn't contain a float or the value can't be converted. getVerticalPosition This method is used to get the float value in a specified unit if the verticalPosition represents a length or a percentage. If the float doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised. The value is 50% if only the horizontal value has been specified. Parameters verticalType The specified unit. Return Value The float value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the property doesn't contain a float or the value can't be converted. setHorizontalPosition This method is used to set the horizontal position with a specified unit. If the vertical value is not a percentage or a length, it sets the vertical position to 50%. Parameters horizontalType The specified unit (a length or a percentage). value The new value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the specified unit is not a length or a percentage. NO_MODIFICATION_ALLOWED_ERR: Raises if this property is readonly. This method returns nothing. setVerticalPosition This method is used to set the vertical position with a specified unit. If the horizontal value is not a percentage or a length, it sets the vertical position to 50%. Parameters verticalType The specified unit (a length or a percentage). value The new value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the specified unit is not a length or a percentage. NO_MODIFICATION_ALLOWED_ERR: Raises if this property is readonly. This method returns nothing. setPositionIdentifier Sets the identifiers. If the second identifier is the empty string, the vertical identifier is set to his default value ("center"). If the first identfier is "inherit, the second identifier is ignored and is set to "inherit". Parameters horizontalIdentifier The new horizontal identifier. verticalIdentifier The new vertical identifier. Exceptions DOMException SYNTAX_ERR: Raises if the identifiers have a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raises if this property is readonly. This method returns nothing. Interface CSS2BorderSpacing The CSS2BorderSpacing interface represents the border-spacing CSS Level 2 property. IDL Definition interface CSS2BorderSpacing : CSSValue { readonly attribute unsigned short horizontalType; readonly attribute unsigned short verticalType; float getHorizontalSpacing(in float horizontalType) raises(DOMException); float getVerticalSpacing(in float verticalType) raises(DOMException); void setHorizontalSpacing(in unsigned short horizontalType, in float value) raises(DOMException); void setVerticalSpacing(in unsigned short verticalType, in float value) raises(DOMException); void setInherit()(); }; Attributes horizontalType The A code defining the type of the value as defined in CSSValue. It would be one of CSS_EMS, CSS_EXS, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC or CSS_INHERIT. verticalType The A code defining the type of the value as defined in CSSValue. It would be one of CSS_EMS, CSS_EXS, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC or CSS_INHERIT. Methods getHorizontalSpacing This method is used to get the float value in a specified unit if the horizontalSpacing represents a length. If the float doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised. Parameters horizontalType The specified unit. Return Value The float value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the property doesn't contain a float or the value can't be converted. getVerticalSpacing This method is used to get the float value in a specified unit if the verticalSpacing represents a length. If the float doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised. The value is 0 if only the horizontal value has been specified. Parameters verticalType The specified unit. Return Value The float value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the property doesn't contain a float or the value can't be converted. setHorizontalSpacing This method is used to set the horizontal spacing with a specified unit. If the vertical value is a length, it sets the vertical spacing to 0. Parameters horizontalType The specified unit. value The new value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the specified unit is not a length. NO_MODIFICATION_ALLOWED_ERR: Raises if this property is readonly. This method returns nothing. setVerticalSpacing This method is used to set the vertical spacing with a specified unit. If the horizontal value is not a length, it sets the vertical spacing to 0. Parameters verticalType The specified unit. value The new value. Exceptions DOMException INVALID_ACCESS_ERR: Raises if the specified unit is not a length or a percentage. NO_MODIFICATION_ALLOWED_ERR: Raises if this property is readonly. This method returns nothing. setInherit() Set this property as inherit. horizontalType and verticalType will be inherited. This method has no parameters. This method returns nothing. This method raises no exceptions. Interface CSS2CounterReset The CSS2CounterReset interface represents a simple value for the counter-reset CSS Level 2 property. IDL Definition interface CSS2CounterReset { attribute DOMString identifier; // raises(DOMException) on setting attribute short reset; // raises(DOMException) on setting }; Attributes identifier The element name. Exceptions on setting DOMException SYNTAX_ERR: Raised if the specified identifier has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this identifier is readonly. reset The reset (default value is 0). Exceptions on setting DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this identifier is readonly. Interface CSS2CounterIncrement The CSS2CounterIncrement interface represents a imple value for the counter-increment CSS Level 2 property. IDL Definition interface CSS2CounterIncrement { attribute DOMString identifier; // raises(DOMException) on setting attribute short increment; // raises(DOMException) on setting }; Attributes identifier The element name. Exceptions on setting DOMException SYNTAX_ERR: Raised if the specified identifier has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: Raised if this identifier is readonly. increment The increment (default value is 1). Exceptions on setting DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this identifier is readonly. Interface CSS2Cursor The CSS2Cursor interface represents the cursor CSS Level 2 property. IDL Definition interface CSS2Cursor : CSSValue { attribute unsigned short cursorType; readonly attribute CSSValueList uris; attribute DOMString predefinedCursor; // raises(DOMException) on setting }; Attributes cursorType A code defining the type of the property. It would one of CSS_UNKNOWN or CSS_INHERIT. If the type is CSS_UNKNOWN, then uris contains a list of URIs and predefinedCursor contains an ident. Setting this attribute from CSS_INHERIT to CSS_UNKNOWN will set the predefinedCursor to "auto". uris uris represents the list of URIs (CSS_URI) on the cursor property. The list can be empty. predefinedCursor This identifier represents a generic cursor name or an empty string. Exceptions on setting DOMException