Section 25.50. CSSRule: a rule in a CSS stylesheet


25.50. CSSRule: a rule in a CSS stylesheet

DOM Level 2 CSS, IE 5: Object CSSRule

25.50.1. Properties


String selectorText

The selector text that specifies the document elements this style rule applies to. Setting this property raises a DOMException with a code of NO_MODIFICATION_ALLOWED_ERR if the rule is read-only or a code of SYNTAX_ERR if the new value does not follow CSS syntax rules.


readonly CSS2Properties style

The style values that should be applied to elements specified by selectorText. Note that while the style property itself is read-only, the properties of the CSS2Properties object to which it refers are read/write.

25.50.2. Description

A CSSRule object represents a rule in a CSS stylesheet: it represents style information to be applied to a specific set of document elements. selectorText is the string representation of the element selector for this rule, and style is a CSS2Properties object that represents the set of style attributes and values to apply to the selected elements.

The DOM Level 2 CSS specification actually defines a somewhat complex hierarchy of CSSRule interfaces to represent different types of rules that can appear in a CSSStyleSheet. The properties listed here are actually defined by the DOM CSSStyleRule interface. Style rules are the most common and most important types of rules in a stylesheet, and the properties listed here are the only ones that can be used portably across browsers. IE does not support the DOM Level 2 specification very well (at least not through IE 7) but does implement a CSSRule object that supports the two properties listed here.

25.50.3. See Also

CSS2Properties, CSSStyleSheet




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