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

Class CSSValue

source code

object --+    
         |    
 util.Base --+
             |
            CSSValue

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
_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=u'inherit', readonly=False)
(cssutils) inits a new CSS Value
source code
 
__invalidToken(self, tokens, x)
raises SyntaxErr if an INVALID token in tokens
source code
 
_getCssText(self) source code
 
_setCssText(self, cssText)
DOMException on setting
source code
 
_getCssValueType(self)
readonly
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]
  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.

Inherited from util.Base (private): _log

Properties [hide private]
  cssText
A string representation of the current value.
  cssValueType
A code defining the type of the value as defined above.

Inherited from object: __class__

Method Details [hide private]

__init__(self, cssText=u'inherit', readonly=False)
(Constructor)

source code 

(cssutils) inits a new CSS Value

cssText
the parsable cssText of the value
readonly
defaults to False
Overrides: object.__init__

__invalidToken(self, tokens, x)

source code 

raises SyntaxErr if an INVALID token in tokens

x
used for error message

returns True if INVALID found, else False

_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.

Property Details [hide private]

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 code defining the type of the value as defined above.
Get Method:
cssutils.css.cssvalue.CSSValue._getCssValueType(self) - readonly
Set Method:
None
Delete Method:
None