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

# Module cssstyledeclaration

source code

CSSStyleDeclaration implements DOM Level 2 CSS CSSStyleDeclaration and inherits 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 WARNING about an unknown CSS2 Property "rotation" but keeps any property (if syntactical 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 WARNING 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: 296 $

Date: $LastChangedDate: 2007-08-29 13:51:12 +0200 (Mi, 29 Aug 2007) $

Author: $LastChangedBy: cthedot $

Classes | [hide private]
| CSSStyleDeclaration The CSSStyleDeclaration class represents a single CSS declaration block.
| SameNamePropertyList (cssutils) EXPERIMENTAL

Imports: xml, cssutils, cssproperties.CSS2Properties, property._Property