Package cssutils :: Package css :: Module cssvalue :: Class CSSValue
[hide private]
[frames] | no frames]

Class CSSValue

source code

object --+    
         |    
 util.Base --+
             |
            CSSValue
Known Subclasses:
CSSPrimitiveValue, CSSValueList

The CSSValue interface represents a simple or a complex value. A CSSValue object only occurs in a context of a CSS property

Properties

cssText
A string representation of the current value.
cssValueType
A (readonly) code defining the type of the value.
seq: a list (cssutils)
All parts of this style declaration including CSSComments
valid: boolean
if the value is valid at all, False for e.g. color: #1
_value
value without any comments, used by Property to validate


Nested Classes [hide private]

Inherited from util.Base (private): _ttypes

Instance Methods [hide private]
 
__init__(self, cssText=None, readonly=False, _propertyName=None)
inits a new CSS Value
source code
 
_getValue(self) source code
 
_setValue(self, value)
overwritten by CSSValueList!
source code
 
_getCssText(self) source code
 
_setCssText(self, cssText)
DOMException on setting
source code
 
_getCssValueType(self) source code
 
_getCssValueTypeString(self) source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
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]
  CSS_INHERIT = 0
The value is inherited and the cssText contains "inherit".
  CSS_PRIMITIVE_VALUE = 1
The value is a primitive value and an instance of the CSSPrimitiveValue interface can be obtained by using binding-specific casting methods on this instance of the CSSValue interface.
  CSS_VALUE_LIST = 2
The value is a CSSValue list and an instance of the CSSValueList interface can be obtained by using binding-specific casting methods on this instance of the CSSValue interface.
  CSS_CUSTOM = 3
The value is a custom value.
  _typestrings = ['CSS_INHERIT', 'CSS_PRIMITIVE_VALUE', 'CSS_VAL...

Inherited from util.Base (private): _log

Properties [hide private]
  _value
Actual cssText value of this CSSValue.
  cssText
A string representation of the current value.
  cssValueType
A (readonly) code defining the type of the value as defined above.
  cssValueTypeString
cssutils: Name of cssValueType of this CSSValue (readonly).

Inherited from object: __class__

Method Details [hide private]

__init__(self, cssText=None, readonly=False, _propertyName=None)
(Constructor)

source code 

inits a new CSS Value

cssText
the parsable cssText of the value
readonly
defaults to False
_propertyName
used to validate this value in the context of a property the name must be normalized: lowercase with no escapes
Overrides: object.__init__

_setCssText(self, cssText)

source code 
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*
  ;

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.
  • NO_MODIFICATION_ALLOWED_ERR: (self) Raised if this value 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)

Class Variable Details [hide private]

_typestrings

Value:
['CSS_INHERIT', 'CSS_PRIMITIVE_VALUE', 'CSS_VALUE_LIST', 'CSS_CUSTOM']

Property Details [hide private]

_value

Actual cssText value of this CSSValue.
Get Method:
cssutils.css.cssvalue.CSSValue._getValue(self)
Set Method:
cssutils.css.cssvalue.CSSValue._setValue(self, value) - overwritten by CSSValueList!
Delete Method:
None

cssText

A string representation of the current value.
Get Method:
cssutils.css.cssvalue.CSSValue._getCssText(self)
Set Method:
cssutils.css.cssvalue.CSSValue._setCssText(self, cssText) - DOMException on setting
Delete Method:
None

cssValueType

A (readonly) code defining the type of the value as defined above.
Get Method:
cssutils.css.cssvalue.CSSValue._getCssValueType(self)
Set Method:
None
Delete Method:
None

cssValueTypeString

cssutils: Name of cssValueType of this CSSValue (readonly).
Get Method:
cssutils.css.cssvalue.CSSValue._getCssValueTypeString(self)
Set Method:
None
Delete Method:
None