Package cssutils :: Package css :: Module cssstyledeclaration |
[hide private]
[frames] | no frames]

# Module cssstyledeclaration

source code

CSSStyleDeclaration implements DOM Level 2 CSS CSSStyleDeclaration and extends CSS2Properties

see
  http://www.w3.org/TR/1998/REC-CSS2-19980512/syndata.html#parsing-errors

# Unknown properties

User agents must ignore a declaration with an unknown property. For example, if the style sheet is:

    H1 { color: red; rotation: 70minutes }

the user agent will treat this as if the style sheet had been:

    H1 { color: red }

Cssutils gives a message about any unknown properties but keeps any property (if syntactically correct).

# Illegal values

User agents must ignore a declaration with an illegal value. For example:

    IMG { float: left }       /* correct CSS2 */
    IMG { float: left here }  /* "here" is not a value of 'float' */
    IMG { background: "red" } /* keywords cannot be quoted in CSS2 */
    IMG { border-width: 3 }   /* a unit must be specified for length values */

A CSS2 parser would honor the first rule and ignore the rest, as if the style sheet had been:

    IMG { float: left }
    IMG { }
    IMG { }
    IMG { }

Cssutils again will issue a message (WARNING in this case) about invalid CSS2 property values.

TODO:

  This interface is also used to provide a read-only access to the computed values of an element. See also the ViewCSS interface.

  - return computed values and not literal values
  - simplify unit pairs/triples/quadruples 2px 2px 2px 2px -> 2px for border/padding...
  - normalize compound properties like: background: no-repeat left url() #fff -> background: #fff url() no-repeat left

Version: $LastChangedRevision: 836 $

Date: $LastChangedDate: 2008-01-13 00:05:26 +0100 (So, 13 Jan 2008) $

Author: $LastChangedBy: cthedot $

Classes | [hide private]
| Property (cssutils) a CSS property in a StyleDeclaration of a CSSStyleRule
| CSSStyleDeclaration The CSSStyleDeclaration class represents a single CSS declaration block.

Imports: xml, cssutils, cssproperties.CSS2Properties