Section 25.51. CSSStyleSheet: a CSS stylesheet


25.51. CSSStyleSheet: a CSS stylesheet

DOM Level 2 CSS, IE 4: Object CSSStyleSheet

25.51.1. Properties


readonly CSSRule[] cssRules

A read-only, array-like object holding the CSSRule objects that compose the stylesheet. In IE, use the rules property instead. In DOM-compliant implementations, this array includes objects that represent all rules in a stylesheet, including at-rules such as @import directives. Rules of these sorts implement a different interface than that described for CSSRule. These other type of rule objects are not well supported across browsers and are not documented in this book. Be aware, therefore, that you must test any entries in this array to ensure that they define CSSRule properties before you attempt to use those properties.


boolean disabled

If true, the stylesheet is disabled and is not applied to the document. If false, the stylesheet is enabled and is applied to the document.


readonly String href

The URL of a stylesheet that is linked to the document or null for inline stylesheets.


readonly StyleSheet parentStyleSheet

The stylesheet that included this one or null if this stylesheet was included directly in the document.


readonly CSSRule[] rules

The IE equivalent of the DOM-standard cssRules[] array.


readonly String title

The title of the stylesheet, if specified. A title may be specified by the title attribute of a <style> or <link> element that refers to this stylesheet.


readonly String type

The type of this stylesheet, as a MIME type. CSS stylesheets have a type of "text/css".

25.51.2. Methods


addRule( )

IE-specific method to add a CSS rule to a stylesheet.


deleteRule( )

DOM-standard method to delete the rule at the specified position.


insertRule( )

DOM-standard method to insert a new rule into the stylesheet.


removeRule( )

IE-specific method to delete a rule.

25.51.3. Description

This interface represents a CSS stylesheet. It has properties and methods for disabling the stylesheet, and for querying, inserting, and removing style rules. IE implements a slightly different API than the DOM standard. In IE, use the rules[] array instead of cssRules[], and use addRule( ) and removeRule( ) instead of the DOM standard insertRule( ) and deleteRule( ).

The CSSStyleSheet objects that apply to a document are members of the styleSheets[] array of the Document object. The DOM standard also requires (although this is not widely implemented at the time of this writing) that any <style> or <link> element or ProcessingInstruction node that defines or links to a stylesheet should make the CSSStyleSheet object available through a sheet property.

25.51.4. See Also

CSSRule, the styleSheets[] property of the Document object; Chapter 16




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net