Package cssutils :: Package css :: Module cssstylerule :: Class CSSStyleRule |
[hide private]
[frames] | no frames]

# Class CSSStyleRule

source code

     object --+
              |
      util.Base --+
                  |
    cssrule.CSSRule --+
                      |
                     CSSStyleRule

The CSSStyleRule object represents a ruleset specified (if any) in a CSS style sheet. It provides access to a declaration block as well as to the associated group of selectors.

# Properties

selectorText: of type DOMString
  The textual representation of the selector for the rule set. The implementation may have stripped out insignificant whitespace while parsing the selector.
style: of type CSSStyleDeclaration, (DOM)
  The declaration-block of this rule set.
inherited properties:
  - cssText
  - parentRule
  - parentStyleSheet
  - type: STYLE_RULE

## cssutils only

selectorList: of type SelectorList (cssutils only)
  A list of all Selector elements for the rule set.

# Format

ruleset:

    : selector [ COMMA S* selector ]*
    LBRACE S* declaration [ ';' S* declaration ]* '}' S*
    ;

Nested Classes | [hide private]
Inherited from `util.Base` (private): `_prods`

Instance Methods | [hide private]
__init__(self, selectorText=None, style=None, readonly=False) if readonly allows setting of properties in constructor only | source code
_getCssText(self) returns serialized property cssText | source code
_setCssText(self, cssText) DOMException on setting | source code
_setSelectorList(self, selectorList) (cssutils) set the SelectorList of this rule | source code
_getSelectorList(self) (cssutils) returns the SelectorList of this rule see selectorText for a textual representation | source code
_getSelectorText(self) wrapper for cssutils SelectorList object | source code
_setSelectorText(self, selectorText) wrapper for cssutils SelectorList object | source code
_getStyle(self) | source code
_setStyle(self, style) StyleDeclaration or string | source code
__repr__(self) repr(x) | source code
__str__(self) str(x) | source code
Inherited from `cssrule.CSSRule` (private): `_getTypeString` Inherited from `util.Base` (private): `_checkReadonly`, `_getProductions`, `_newseq`, `_nexttoken`, `_parse`, `_tokenize2`, `_tokensupto2`, `_tokenvalue`, `_type`, `_valuestr` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Static Methods | [hide private]
Inherited from `util.Base` (private): `_normalize`

Class Variables | [hide private]
| type = `1` The type of this rule, as defined by a CSSRule type constant.
Inherited from `cssrule.CSSRule`: `COMMENT`, `FONT_FACE_RULE`, `UNKNOWN_RULE` Inherited from `cssrule.CSSRule` (private): `_typestrings` Inherited from `util.Base` (private): `_SHORTHANDPROPERTIES`, `_log`

Properties | [hide private]
| cssText (DOM) The parsable textual representation of the rule.
| selectorList The SelectorList of this rule.
| selectorText (DOM) The textual representation of the selector for the rule set.
| style (DOM) The declaration-block of this rule set.
Inherited from `cssrule.CSSRule`: `typeString` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, selectorText=None, style=None, readonly=False) (Constructor) | source code
if readonly allows setting of properties in constructor only selectorText type string style CSSStyleDeclaration for this CSSStyleRule Overrides: cssrule.CSSRule.__init__

### _getCssText(self) | source code
returns serialized property cssText Overrides: cssrule.CSSRule._getCssText

### _setCssText(self, cssText) | source code
DOMException on setting SYNTAX_ERR: (self, StyleDeclaration, etc) Raised if the specified CSS string value has a syntax error and is unparsable. INVALID_MODIFICATION_ERR: (self) Raised if the specified CSS string value represents a different type of rule than the current one. HIERARCHY_REQUEST_ERR: (CSSStylesheet) Raised if the rule cannot be inserted at this point in the style sheet. NO_MODIFICATION_ALLOWED_ERR: (CSSRule) Raised if the rule is readonly. Overrides: cssrule.CSSRule._setCssText

### _setSelectorList(self, selectorList) | source code
(cssutils) set the SelectorList of this rule selectorList instance of SelectorList DOMException on setting NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is readonly.

### _setSelectorText(self, selectorText) | source code
wrapper for cssutils SelectorList object selector of type string, might also be a comma separated list of selectors DOMException on setting SYNTAX_ERR: (SelectorList, Selector) Raised if the specified CSS string value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: (self) Raised if this rule is readonly.

### __repr__(self) (Representation operator) | source code
repr(x) Overrides: object.__repr__ (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

Property Details | [hide private]

  ### cssText (DOM) The parsable textual representation of the rule. Get Method: cssutils.css.cssstylerule.CSSStyleRule._getCssText(self) - returns serialized property cssText Set Method: cssutils.css.cssstylerule.CSSStyleRule._setCssText(self, cssText) - DOMException on setting Delete Method:
      None

  ### selectorList The SelectorList of this rule. Get Method: cssutils.css.cssstylerule.CSSStyleRule._getSelectorList(self) - (cssutils) returns the SelectorList of this rule see selectorText for a textual representation Set Method: cssutils.css.cssstylerule.CSSStyleRule._setSelectorList(self, selectorList) - (cssutils) set the SelectorList of this rule Delete Method:
      None

  ### selectorText (DOM) The textual representation of the selector for the rule set. Get Method: cssutils.css.cssstylerule.CSSStyleRule._getSelectorText(self) - wrapper for cssutils SelectorList object Set Method: cssutils.css.cssstylerule.CSSStyleRule._setSelectorText(self, selectorText) - wrapper for cssutils SelectorList object Delete Method:
      None

  ### style (DOM) The declaration-block of this rule set. Get Method: cssutils.css.cssstylerule.CSSStyleRule._getStyle(self) Set Method: cssutils.css.cssstylerule.CSSStyleRule._setStyle(self, style) - StyleDeclaration or string Delete Method:
      None