Package cssutils :: Package css :: Module property :: Class _Property
[hide private]
[frames] | no frames]

Class _Property

source code

object --+    
         |    
 util.Base --+
             |
            _Property

(cssutils) a CSS property in a StyleDeclaration of a CSSStyleRule

Properties

name
of the property
normalname
normalized name of the property, e.g. "color" when name is "color"
cssValue
the relevant CSSValue instance for this property
priority
of the property (currently only "!important" or None)
seqs
combination of a list for seq of name, a CSSValue object, and a list for seq of priority (empty or [!important] currently)
valid
if this Property is valid
DEPRECATED: value
the string value of the property, use cssValue.cssText instead!

Format

property = name
  : IDENT S*
  ;

expr = value
  : term [ operator term ]*
  ;
term
  : unary_operator?
    [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* |
      TIME S* | FREQ S* | function ]
  | STRING S* | IDENT S* | URI S* | hexcolor
  ;
function
  : FUNCTION S* expr ')' S*
  ;
/*
 * There is a constraint on the color that it must
 * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])
 * after the "#"; e.g., "#000" is OK, but "#abcd" is not.
 */
hexcolor
  : HASH S*
  ;

prio
  : IMPORTANT_SYM S*
  ;


Nested Classes [hide private]

Inherited from util.Base (private): _ttypes

Instance Methods [hide private]
 
__init__(self, name, value, priority=None)
inits property
source code
 
__invalidToken(self, tokens, x)
raises SyntaxErr if an INVALID token in tokens
source code
 
_getName(self) source code
 
_setName(self, name)
: IDENT S* ;
source code
 
_getCSSValue(self) source code
 
_setCSSValue(self, cssText)
see css.CSSValue
source code
 
_getPriority(self) source code
 
_setPriority(self, priority)
currently "!important" to set an important priority or None or the empty string to set no priority only
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code
 
_getValue(self) source code
 
_setValue(self, value) source code
 
_Property__invalidToken(self, tokens, x)
raises SyntaxErr if an INVALID token in tokens
source code

Inherited from util.Base (private): _checkReadonly, _tokenize, _tokensupto, _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]

Inherited from util.Base (private): _log

Properties [hide private]
  name
(cssutils) Name of this property
  cssValue
(cssutils) CSSValue object of this property
  priority
(cssutils) Priority of this property
  value
DEPRECATED use cssValue instead

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, value, priority=None)
(Constructor)

source code 
inits property
Overrides: object.__init__

__invalidToken(self, tokens, x)

source code 

raises SyntaxErr if an INVALID token in tokens

x
name, value or priority, used for error message

returns True if INVALID found, else False

_setName(self, name)

source code 
property = name
: IDENT S* ;

DOMException on setting

  • SYNTAX_ERR: (self) Raised if the specified name has a syntax error and is unparsable.

_setCSSValue(self, cssText)

source code 

see css.CSSValue

DOMException on setting?

  • SYNTAX_ERR: (self) Raised if the specified CSS string value has a syntax error (according to the attached property) or is unparsable.
  • TODO: INVALID_MODIFICATION_ERR: Raised if the specified CSS string value represents a different type of values than the values allowed by the CSS property.

_setPriority(self, priority)

source code 
priority
currently "!important" to set an important priority or None or the empty string to set no priority only

Format

prio
  : IMPORTANT_SYM S*
  ;
"!"{w}"important"   {return IMPORTANT_SYM;}

DOMException on setting

  • SYNTAX_ERR: (self) Raised if the specified priority has a syntax error and is unparsable. In this case a priority not equal to None, "" or "!{w}important".

__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__invalidToken(self, tokens, x)

source code 

raises SyntaxErr if an INVALID token in tokens

x
name, value or priority, used for error message

returns True if INVALID found, else False


Property Details [hide private]

name

(cssutils) Name of this property
Get Method:
cssutils.css.property._Property._getName(self)
Set Method:
cssutils.css.property._Property._setName(self, name) - : IDENT S* ;
Delete Method:
None

cssValue

(cssutils) CSSValue object of this property
Get Method:
cssutils.css.property._Property._getCSSValue(self)
Set Method:
cssutils.css.property._Property._setCSSValue(self, cssText) - see css.CSSValue
Delete Method:
None

priority

(cssutils) Priority of this property
Get Method:
cssutils.css.property._Property._getPriority(self)
Set Method:
cssutils.css.property._Property._setPriority(self, priority) - currently "!important" to set an important priority or None or the empty string to set no priority only
Delete Method:
None

value

DEPRECATED use cssValue instead
Get Method:
cssutils.css.property._Property._getValue(self)
Set Method:
cssutils.css.property._Property._setValue(self, value)
Delete Method:
None