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

Class CSSRule

source code

object --+        
         |        
 util.Base --+    
             |    
    util.Base2 --+
                 |
                CSSRule
Known Subclasses:

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 (READONLY):
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
wellformed:
if a rule is valid
Nested Classes [hide private]

Inherited from util.Base (private): _prods

Instance Methods [hide private]
 
__init__(self, parentRule=None, parentStyleSheet=None, readonly=False)
set common attributes for all rules
source code
 
_setCssText(self, cssText)
DOMException on setting
source code
 
_setAtkeyword(self, akw)
checks if new keyword is normalized same as old
source code

Inherited from util.Base2 (private): _adddefaultproductions, _setSeq, _tempSeq

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]
  COMMENT = -1
  UNKNOWN_RULE = 0
  STYLE_RULE = 1
A (readonly) code defining the type of the value as defined above.
  CHARSET_RULE = 2
A (readonly) code defining the type of the value as defined above.
  IMPORT_RULE = 3
  MEDIA_RULE = 4
  FONT_FACE_RULE = 5
  PAGE_RULE = 6
  NAMESPACE_RULE = 7
  _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): _SHORTHANDPROPERTIES, _log

Properties [hide private]
  cssText
(DOM) The parsable textual representation of the rule.
  atkeyword
@keyword for @rules
  parentRule
READONLY
  parentStyleSheet
READONLY
  wellformed
READONLY
  typeString
Name of this rules type.

Inherited from util.Base2: seq

Inherited from object: __class__

Method Details [hide private]

__init__(self, parentRule=None, parentStyleSheet=None, readonly=False)
(Constructor)

source code 
set common attributes for all rules
Overrides: object.__init__

_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:
unreachable(self)
Set Method:
_setCssText(self, cssText) - DOMException on setting

atkeyword

@keyword for @rules
Get Method:
unreachable(self)
Set Method:
_setAtkeyword(self, akw) - checks if new keyword is normalized same as old

parentRule

READONLY
Get Method:
unreachable(self)

parentStyleSheet

READONLY
Get Method:
unreachable(self)

wellformed

READONLY
Get Method:
unreachable(self)

typeString

Name of this rules type.
Get Method:
unreachable(self)