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

cssText
a parsable textual representation of this property
name
normalized name of the property, e.g. "color" when name is "color" (since 0.9.5)
literalname (since 0.9.5)
original name of the property in the source CSS which is not normalized e.g. "COLor"
cssValue
the relevant CSSValue instance for this property
value
the string value of the property, same as cssValue.cssText
priority
of the property (currently only u"important" or None)
literalpriority
original priority of the property in the source CSS which is not normalized e.g. "IMportant"
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
wellformed
if this Property is syntactically ok
DEPRECATED normalname (since 0.9.5)
normalized name of the property, e.g. "color" when name is "color"

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): _prods

Instance Methods [hide private]
 
__init__(self, name=None, value=None, priority=u'', _mediaQuery=False)
inits property
source code
 
_getCssText(self)
returns serialized property cssText
source code
 
_setCssText(self, cssText)
DOMException on setting
source code
 
_setName(self, name)
DOMException on setting
source code
 
_getCSSValue(self) source code
 
_setCSSValue(self, cssText)
see css.CSSValue
source code
 
_getValue(self) source code
 
_setValue(self, value) source code
 
_setPriority(self, priority)
a string, currently either u'', u'!important' or u'important'
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code
 
_getNormalname(*args, **kwargs) source code

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): _SHORTHANDPROPERTIES, _log

Properties [hide private]
  cssText
A parsable textual representation.
  name
Name of this property
  literalname
Readonly literal (not normalized) name of this property
  cssValue
(cssutils) CSSValue object of this property
  value
The textual value of this Properties cssValue.
  priority
(cssutils) Priority of this property
  literalpriority
Readonly literal (not normalized) priority of this property
  normalname
DEPRECATED since 0.9.5, use name instead

Inherited from object: __class__

Method Details [hide private]

__init__(self, name=None, value=None, priority=u'', _mediaQuery=False)
(Constructor)

source code 

inits property

name
a property name string (will be normalized)
value
a property value string
priority
an optional priority string which currently must be u'', u'!important' or u'important'
_mediaQuery boolean
if True value is optional as used by MediaQuery objects
Overrides: object.__init__

_setCssText(self, cssText)

source code 

DOMException on setting

  • NO_MODIFICATION_ALLOWED_ERR: (CSSRule) Raised if the rule is readonly.
  • SYNTAX_ERR: (self) Raised if the specified CSS string value has a syntax error and is unparsable.

_setName(self, name)

source code 

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
a string, currently either u'', u'!important' or u'important'

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". As CSSOM defines CSSStyleDeclaration.getPropertyPriority resulting in u'important' this value is also allowed to set a Properties priority

__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)

_getNormalname(*args, **kwargs)

source code 
Decorators:
  • @Deprecated(u'Use property ``name`` instead (since cssutils 0.9.5).')

Property Details [hide private]

cssText

A parsable textual representation.
Get Method:
_getCssText(self) - returns serialized property cssText
Set Method:
_setCssText(self, cssText) - DOMException on setting

name

Name of this property
Get Method:
unreachable(self)
Set Method:
_setName(self, name) - DOMException on setting

literalname

Readonly literal (not normalized) name of this property
Get Method:
unreachable(self)

cssValue

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

value

The textual value of this Properties cssValue.
Get Method:
_getValue(self)
Set Method:
_setValue(self, value)

priority

(cssutils) Priority of this property
Get Method:
unreachable(self)
Set Method:
_setPriority(self, priority) - a string, currently either u'', u'!important' or u'important'

literalpriority

Readonly literal (not normalized) priority of this property
Get Method:
unreachable(self)

normalname

DEPRECATED since 0.9.5, use name instead
Get Method:
_getNormalname(*args, **kwargs)