WD-DOM-Level-2-19990304


4. Document Object Model CSS

Editors
Vidur Apparao, Netscape Communications Corp.
Chris Wilson, Microsoft

Table of contents


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.

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  CSSRuleCollection    cssRules;
  unsigned long             insertRule(in DOMString rule, 
                                       in unsigned long index)
                                       raises(DOMException);
  void                      deleteRule(in unsigned long index)
                                       raises(DOMException);
};

Attributes
cssRules
The collection 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 collection 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.


deleteRule
Used to delete a rule from the style sheet.
Parameters
index

The index within the style sheet'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 style sheet's rule collection.


This method returns nothing.
Interface CSSRuleCollection

The CSSRuleCollection interface provides the abstraction of an ordered collection of CSS rules.

IDL Definition
interface CSSRuleCollection {
  readonly attribute  unsigned long        length;
  CSSRule                   item(in unsigned long index);
};

Attributes
length
The length or the size of the list.
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 CSSRuleCollection, 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 .

IDL Definition
interface CSSRule {
  // RuleType
  const unsigned short      UNKNOWN_RULE       = 0;
  const unsigned short      STYLE_RULE         = 1;
  const unsigned short      IMPORT_RULE        = 2;
  const unsigned short      MEDIA_RULE         = 3;
  const unsigned short      FONT_FACE_RULE     = 4;
  const unsigned short      PAGE_RULE          = 5;

  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.

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
A code defining the type of the rule, as defined above.
cssText
The parsable textual representation of the rule.
Exceptions on setting
DOMException

SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable.

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;
  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.
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 {
           attribute  DOMString            mediaTypes;
  readonly attribute  CSSRuleCollection    cssRules;
  unsigned long             insertRule(in DOMString rule, 
                                       in unsigned long index)
                                       raises(DOMException);
  void                      deleteRule(in unsigned long index);
};

Attributes
mediaTypes
A comma-separate list of media types for this rule. This attribute does not include the "@media" specifier.
cssRules
A collection 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.


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.


This method returns nothing.
This method raises no exceptions.
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;
  readonly attribute  CSSStyleDeclaration  style;
};

Attributes
selectorText
The parsable textual representation of the page selector for the rule.
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 {
           attribute  DOMString            href;
           attribute  DOMString            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 comma-separated 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 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.

IDL Definition
interface CSSStyleDeclaration {
           attribute  DOMString            cssText;
                                       // raises(DOMException) on setting
  DOMString                 getPropertyValue(in DOMString propertyName);
  DOMString                 removeProperty(in DOMString propertyName);
  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.

Methods
getPropertyValue
Used the 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.
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.

This method raises no exceptions.
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 the 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.


This method returns nothing.
Attributes
length
The number of properties that have been explicitly set in this declaration block.
Methods
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.
Attributes
parentRule
The CSS rule that contains this declaration block.

4.3. CSS Extended Interfaces

The interfaces found within this section are not mandatory. They may be implemented by a DOM implementation as a convenience to the DOM script user.

Interface CSS2Properties

The CSS2Properties interface represents a convenience mechanism for retrieving and setting properties within a CSSStyleDeclaration. The attributes of this interface correspond to all the properties specified in CSS2 . Getting an attribute of this interface is equivalent to calling the getPropertyValue method of the CSSStyleDeclaration interface. Setting an attribute of this interface is equivalent to calling the setProperty method of the CSSStyleDeclaration interface.

A compliant implementation is not required to implement the CSS2Properties interface. If an implementation does implement this interface, it is expected to understand the specific syntax of the shorthand properties, and apply their semantics; when the margin property is set, for example, the marginTop, marginRight, marginBottom and marginLeft properties are actually being set by the underlying implementation.

When dealing with CSS "shorthand" properties, the shorthand properties should be decomposed into their component longhand properties as appropriate, and when querying for their value, the form returned should be the shortest form exactly equivalent to the declarations made in the ruleset. However, if there is no shorthand declaration that could be added to the ruleset without changing in any way the rules already declared in the ruleset (i.e., by adding longhand rules that were previously not declared in the ruleset), then the empty string should be returned for the shorthand property.

For example, querying for the font property should not return "normal normal normal 14pt/normal Arial, sans-serif", when "14pt Arial, sans-serif" suffices (the normals are initial values, and are implied by use of the longhand property).

If the values for all the longhand properties that compose a particular string are the initial values, then a string consisting of all the initial values should be returned (e.g. a 'border-width' value of "medium" should be returned as such, not as "").

For some shorthand properties that take missing values from other sides, such as the margin, padding, and border-[width|style|color] properties, the minimum number of sides possible should be used, i.e., "0px 10px" will be returned instead of "0px 10px 0px 10px".

IDL Definition
interface CSS2Properties {
           attribute  DOMString            azimuth;
           attribute  DOMString            background;
           attribute  DOMString            backgroundAttachment;
           attribute  DOMString            backgroundColor;
           attribute  DOMString            backgroundImage;
           attribute  DOMString            backgroundPosition;
           attribute  DOMString            backgroundRepeat;
           attribute  DOMString            border;
           attribute  DOMString            borderCollapse;
           attribute  DOMString            borderColor;
           attribute  DOMString            borderSpacing;
           attribute  DOMString            borderStyle;
           attribute  DOMString            borderTop;
           attribute  DOMString            borderRight;
           attribute  DOMString            borderBottom;
           attribute  DOMString            borderLeft;
           attribute  DOMString            borderTopColor;
           attribute  DOMString            borderRightColor;
           attribute  DOMString            borderBottomColor;
           attribute  DOMString            borderLeftColor;
           attribute  DOMString            borderTopStyle;
           attribute  DOMString            borderRightStyle;
           attribute  DOMString            borderBottomStyle;
           attribute  DOMString            borderLeftStyle;
           attribute  DOMString            borderTopWidth;
           attribute  DOMString            borderRightWidth;
           attribute  DOMString            borderBottomWidth;
           attribute  DOMString            borderLeftWidth;
           attribute  DOMString            borderWidth;
           attribute  DOMString            bottom;
           attribute  DOMString            captionSide;
           attribute  DOMString            clear;
           attribute  DOMString            clip;
           attribute  DOMString            color;
           attribute  DOMString            content;
           attribute  DOMString            counterIncrement;
           attribute  DOMString            counterReset;
           attribute  DOMString            cue;
           attribute  DOMString            cueAfter;
           attribute  DOMString            cueBefore;
           attribute  DOMString            cursor;
           attribute  DOMString            direction;
           attribute  DOMString            display;
           attribute  DOMString            elevation;
           attribute  DOMString            emptyCells;
           attribute  DOMString            cssFloat;
           attribute  DOMString            font;
           attribute  DOMString            fontFamily;
           attribute  DOMString            fontSize;
           attribute  DOMString            fontSizeAdjust;
           attribute  DOMString            fontStretch;
           attribute  DOMString            fontStyle;
           attribute  DOMString            fontVariant;
           attribute  DOMString            fontWeight;
           attribute  DOMString            height;
           attribute  DOMString            left;
           attribute  DOMString            letterSpacing;
           attribute  DOMString            lineHeight;
           attribute  DOMString            listStyle;
           attribute  DOMString            listStyleImage;
           attribute  DOMString            listStylePosition;
           attribute  DOMString            listStyleType;
           attribute  DOMString            margin;
           attribute  DOMString            marginTop;
           attribute  DOMString            marginRight;
           attribute  DOMString            marginBottom;
           attribute  DOMString            marginLeft;
           attribute  DOMString            markerOffset;
           attribute  DOMString            marks;
           attribute  DOMString            maxHeight;
           attribute  DOMString            maxWidth;
           attribute  DOMString            minHeight;
           attribute  DOMString            minWidth;
           attribute  DOMString            orphans;
           attribute  DOMString            outline;
           attribute  DOMString            outlineColor;
           attribute  DOMString            outlineStyle;
           attribute  DOMString            outlineWidth;
           attribute  DOMString            overflow;
           attribute  DOMString            padding;
           attribute  DOMString            paddingTop;
           attribute  DOMString            paddingRight;
           attribute  DOMString            paddingBottom;
           attribute  DOMString            paddingLeft;
           attribute  DOMString            page;
           attribute  DOMString            pageBreakAfter;
           attribute  DOMString            pageBreakBefore;
           attribute  DOMString            pageBreakInside;
           attribute  DOMString            pause;
           attribute  DOMString            pauseAfter;
           attribute  DOMString            pauseBefore;
           attribute  DOMString            pitch;
           attribute  DOMString            pitchRange;
           attribute  DOMString            playDuring;
           attribute  DOMString            position;
           attribute  DOMString            quotes;
           attribute  DOMString            richness;
           attribute  DOMString            right;
           attribute  DOMString            size;
           attribute  DOMString            speak;
           attribute  DOMString            speakHeader;
           attribute  DOMString            speakNumeral;
           attribute  DOMString            speakPunctuation;
           attribute  DOMString            speechRate;
           attribute  DOMString            stress;
           attribute  DOMString            tableLayout;
           attribute  DOMString            textAlign;
           attribute  DOMString            textDecoration;
           attribute  DOMString            textIndent;
           attribute  DOMString            textShadow;
           attribute  DOMString            textTransform;
           attribute  DOMString            top;
           attribute  DOMString            unicodeBidi;
           attribute  DOMString            verticalAlign;
           attribute  DOMString            visibility;
           attribute  DOMString            voiceFamily;
           attribute  DOMString            volume;
           attribute  DOMString            whiteSpace;
           attribute  DOMString            widows;
           attribute  DOMString            width;
           attribute  DOMString            wordSpacing;
           attribute  DOMString            zIndex;
};

Attributes
azimuth
See the azimuth property definition in CSS2.
background
See the background property definition in CSS2.
backgroundAttachment
See the background-attachment property definition in CSS2.
backgroundColor
See the background-color property definition in CSS2.
backgroundImage
See the background-image property definition in CSS2.
backgroundPosition
See the background-position property definition in CSS2.
backgroundRepeat
See the background-repeat property definition in CSS2.
border
See the border property definition in CSS2.
borderCollapse
See the border-collapse property definition in CSS2.
borderColor
See the border-color property definition in CSS2.
borderSpacing
See the border-spacing property definition in CSS2.
borderStyle
See the border-style property definition in CSS2.
borderTop
See the border-top property definition in CSS2.
borderRight
See the border-right property definition in CSS2.
borderBottom
See the border-bottom property definition in CSS2.
borderLeft
See the border-left property definition in CSS2.
borderTopColor
See the border-top-color property definition in CSS2.
borderRightColor
See the border-right-color property definition in CSS2.
borderBottomColor
See the border-bottom-color property definition in CSS2.
borderLeftColor
See the border-left-color property definition in CSS2.
borderTopStyle
See the border-top-style property definition in CSS2.
borderRightStyle
See the border-right-style property definition in CSS2.
borderBottomStyle
See the border-bottom-style property definition in CSS2.
borderLeftStyle
See the border-left-style property definition in CSS2.
borderTopWidth
See the border-top-width property definition in CSS2.
borderRightWidth
See the border-right-width property definition in CSS2.
borderBottomWidth
See the border-bottom-width property definition in CSS2.
borderLeftWidth
See the border-left-width property definition in CSS2.
borderWidth
See the border-width property definition in CSS2.
bottom
See the bottom property definition in CSS2.
captionSide
See the caption-side property definition in CSS2.
clear
See the clear property definition in CSS2.
clip
See the clip property definition in CSS2.
color
See the color property definition in CSS2.
content
See the content property definition in CSS2.
counterIncrement
See the counter-increment property definition in CSS2.
counterReset
See the counter-reset property definition in CSS2.
cue
See the cue property definition in CSS2.
cueAfter
See the cue-after property definition in CSS2.
cueBefore
See the cue-before property definition in CSS2.
cursor
See the cursor property definition in CSS2.
direction
See the direction property definition in CSS2.
display
See the display property definition in CSS2.
elevation
See the elevation property definition in CSS2.
emptyCells
See the empty-cells property definition in CSS2.
cssFloat
See the float property definition in CSS2.
font
See the font property definition in CSS2.
fontFamily
See the font-family property definition in CSS2.
fontSize
See the font-size property definition in CSS2.
fontSizeAdjust
See the font-size-adjust property definition in CSS2.
fontStretch
See the font-stretch property definition in CSS2.
fontStyle
See the font-style property definition in CSS2.
fontVariant
See the font-variant property definition in CSS2.
fontWeight
See the font-weight property definition in CSS2.
height
See the height property definition in CSS2.
left
See the left property definition in CSS2.
letterSpacing
See the letter-spacing property definition in CSS2.
lineHeight
See the line-height property definition in CSS2.
listStyle
See the list-style property definition in CSS2.
listStyleImage
See the list-style-image property definition in CSS2.
listStylePosition
See the list-style-position property definition in CSS2.
listStyleType
See the list-style-type property definition in CSS2.
margin
See the margin property definition in CSS2.
marginTop
See the margin-top property definition in CSS2.
marginRight
See the margin-right property definition in CSS2.
marginBottom
See the margin-bottom property definition in CSS2.
marginLeft
See the margin-left property definition in CSS2.
markerOffset
See the marker-offset property definition in CSS2.
marks
See the marks property definition in CSS2.
maxHeight
See the max-height property definition in CSS2.
maxWidth
See the max-width property definition in CSS2.
minHeight
See the min-height property definition in CSS2.
minWidth
See the min-width property definition in CSS2.
orphans
See the orphans property definition in CSS2.
outline
See the outline property definition in CSS2.
outlineColor
See the outline-color property definition in CSS2.
outlineStyle
See the outline-style property definition in CSS2.
outlineWidth
See the outline-width property definition in CSS2.
overflow
See the overflow property definition in CSS2.
padding
See the padding property definition in CSS2.
paddingTop
See the padding-top property definition in CSS2.
paddingRight
See the padding-right property definition in CSS2.
paddingBottom
See the padding-bottom property definition in CSS2.
paddingLeft
See the padding-left property definition in CSS2.
page
See the page property definition in CSS2.
pageBreakAfter
See the page-break-after property definition in CSS2.
pageBreakBefore
See the page-break-before property definition in CSS2.
pageBreakInside
See the page-break-inside property definition in CSS2.
pause
See the pause property definition in CSS2.
pauseAfter
See the pause-after property definition in CSS2.
pauseBefore
See the pause-before property definition in CSS2.
pitch
See the pitch property definition in CSS2.
pitchRange
See the pitch-range property definition in CSS2.
playDuring
See the play-during property definition in CSS2.
position
See the position property definition in CSS2.
quotes
See the quotes property definition in CSS2.
richness
See the richness property definition in CSS2.
right
See the right property definition in CSS2.
size
See the size property definition in CSS2.
speak
See the speak property definition in CSS2.
speakHeader
See the speak-header property definition in CSS2.
speakNumeral
See the speak-numeral property definition in CSS2.
speakPunctuation
See the speak-punctuation property definition in CSS2.
speechRate
See the speech-rate property definition in CSS2.
stress
See the stress property definition in CSS2.
tableLayout
See the table-layout property definition in CSS2.
textAlign
See the text-align property definition in CSS2.
textDecoration
See the text-decoration property definition in CSS2.
textIndent
See the text-indent property definition in CSS2.
textShadow
See the text-shadow property definition in CSS2.
textTransform
See the text-transform property definition in CSS2.
top
See the top property definition in CSS2.
unicodeBidi
See the unicode-bidi property definition in CSS2.
verticalAlign
See the vertical-align property definition in CSS2.
visibility
See the visibility property definition in CSS2.
voiceFamily
See the voice-family property definition in CSS2.
volume
See the volume property definition in CSS2.
whiteSpace
See the white-space property definition in CSS2.
widows
See the widows property definition in CSS2.
width
See the width property definition in CSS2.
wordSpacing
See the word-spacing property definition in CSS2.
zIndex
See the z-index property definition in CSS2.

4.4. Extensions to Level 1 Interfaces

(ED: This section will dissipate into other sections of the Level 2 DOM as they develop. These extensions are placed here until those other sections are prepared. )

4.4.1. Document style sheets

A collection of all style sheets linked into or embedded in the document is exposed through the styleSheets attribute. In HTML, this collection contains both external style sheets, included via the LINK element, and inline style sheets, included via STYLE elements. In XML, this collection contains all external style sheets included via a style sheet processing instruction .



    interface  Document2 : Document {
      readonly attribute StyleSheetCollection styleSheets;
    };
       

4.4.2. HTMLElement inline style

Inline style information attached to HTML elements is exposed through the style attribute. This represents the contents of the STYLE attribute for HTML elements.



    interface HTMLElement2 : HTMLElement {
      readonly attribute CSSStyleDeclaration style;
    };
        

4.4.3. HTMLStyleElement style sheet

The style sheet associated with an HTML STYLE element is accessible via the styleSheet attribute.



    interface HTMLStyleElement2 : HTMLStyleElement {
      readonly attribute StyleSheet styleSheet;
    };
        

4.4.4. HTMLLinkElement style sheet

The styleSheet associated with an HTML LINK element with a REL of "stylesheet" or "alternate stylesheet" is not accessible directly. This is because LINK elements are not used purely as a stylesheet linking mechanism. The styleSheet property on LINK elements with other relationships would be incongruous.

4.5. Unresolved Issues

  1. The CSS Editorial team is considering a way to represent comments that exist within a CSS style sheet. Our expectation is that absolute position of comments may not be maintained, but relative position (with respect to CSS rules and CSS properties) and the actual contents of the comment will be.
  2. The CSS Editorial team is considering a mechanism to allow users to retrieve the cascaded and computed styles for a specific element.We do not intend to provide access to the actual style of specific elements in this level of the CSS DOM. Implementation of the CSS DOM does not require an actual rendering engine for any other reason, and we see that requirement as a limitation on the potential implementations of the CSS DOM.
  3. The CSS Editorial team is considering a mechanism to allow users to change the cascaded style for a specific element, or to create rules in an "override" style sheet.
  4. The Working Group is still considering whether it should be possible to create style sheets outside the context of a document, abstract from any XML- or HTML-specific embedding or linking of a style sheet.
  5. The DOM Working Group is considering whether more structure is necessary in the representation of CSS style rules; specifically, providing access to the selector other than as a string, and providing more structured representation of the varied CSS2 properties.
  6. The group is undecided whether to put a cssText attribute on the CSSStyleSheet, which would provide a textual representation of the entire style sheet. Setting this attribute would result in the resetting of all the rules in the style sheet.
  7. We still need to create a CSSException inherited from DOMException, to allow easier catching of CSS-specific exceptions.