Package cssutils :: Package css :: Module cssrule :: Class CSSRule |
[hide private]
[frames] | no frames]

# Class CSSRule

source code

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

Known Subclasses:
  csscharsetrule.CSSCharsetRule, csscomment.CSSComment, cssimportrule.CSSImportRule, cssmediarule.CSSMediaRule, cssnamespacerule.CSSNamespaceRule, csspagerule.CSSPageRule, cssstylerule.CSSStyleRule, cssunknownrule.CSSUnknownRule

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 the rule is not recognized by the parser. Unrecognized rules are represented using the CSSUnknownRule interface.

# Properties

cssText: of type DOMString
  The parsable textual representation of the rule. This reflects the current state of the rule and not its initial value.
parentRule: of type CSSRule, readonly
  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 None.
parentStyleSheet: of type CSSStyleSheet, readonly
  The style sheet that contains this rule.
type: of type unsigned short, readonly
  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.

## cssutils only

seq:
  contains sequence of parts of the rule including comments but excluding @KEYWORD and braces
typeString: string
  A string name of the type of this rule, e.g. 'STYLE_RULE'. Mainly useful for debugging
valid:
  if this rule is valid

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

Instance Methods | [hide private]
__init__(self, readonly=False) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
_getCssText(self) | source code
_setCssText(self, cssText) DOMException on setting | source code
_getTypeString(self) | source code
Inherited from `util.Base` (private): `_checkReadonly`, `_tokenize`, `_tokensupto`, `_valuestr` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

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

Class Variables | [hide private]
| UNKNOWN_RULE = `0`
| FONT_FACE_RULE = `5` Not in CSS 2.1 specification and not implemented
| _typestrings = ``[``'``UNKNOWN_RULE``'``,` `'``STYLE_RULE``'``,` `'``CHARSET_RULE``'``,` `...``
| type = `0` The type of this rule, as defined by a CSSRule type constant.
Inherited from `util.Base` (private): `_log`

Properties | [hide private]
| cssText (DOM) The parsable textual representation of the rule.
| typeString Name of this rules type.
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, readonly=False) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

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

Class Variable Details | [hide private]

  ### _typestrings Value:
      ['UNKNOWN_RULE',
       'STYLE_RULE',
       'CHARSET_RULE',
       'IMPORT_RULE',
       'MEDIA_RULE',
       'FONT_FACE_RULE',
       'PAGE_RULE',
       'NAMESPACE_RULE',
      ...

  ### type The type of this rule, as defined by a CSSRule type constant. Overwritten in derived classes. 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. (Casting not for this Python implementation I guess...) Value:
      0

Property Details | [hide private]

  ### cssText (DOM) The parsable textual representation of the rule. This reflects the current state of the rule and not its initial value. The initial value is saved, but this may be removed in a future version! MUST BE OVERWRITTEN IN SUBCLASS TO WORK! Get Method: cssutils.css.cssrule.CSSRule._getCssText(self) Set Method: cssutils.css.cssrule.CSSRule._setCssText(self, cssText) - DOMException on setting Delete Method:
      None

  ### typeString Name of this rules type. Get Method: cssutils.css.cssrule.CSSRule._getTypeString(self) Set Method:
      None
  Delete Method:
      None