Index

# package `cssutils.css`

author: | $LastChangedBy: cthedot $
date: | $LastChangedDate: 2007-08-08 16:14:03 +0200 (Mi, 08 Aug 2007) $
version: | $LastChangedRevision: 206 $

Contents

- package `cssutils.css`
  - overview
  - Shared Attributes
  - CSSStyleSheet
    - Attributes
  - CSSCharsetRule
  - CSSNamespaceRule
  - CSSImportRule
  - CSSMediaRule
  - CSSFontFaceRule
  - CSSPageRule
  - CSSStyleRule

## overview

Classes implementing DOM Level 2 CSS and CSS Module: Namespaces (W3C Working Draft 28 August 2006)

CSSStyleSheet: | Implements `stylesheets.StyleSheet` and is the root of a stylesheet.
CSSCharsetRule: | @charset rule
CSSFontFaceRule: | @font-face rule (from v0.9.5a4)
CSSImportRule: | @import rule
CSSMediaRule: | @media rule
CSSNamespaceRule: | @namespace rule
CSSPageRule: | @page rule
CSSStyleRule: | Main Rule with Selectors and `CSSStyleDeclaration`
CSSStyleDeclaration: | Containing a list of Properties
Property: | A single property with name, value and priority information, used for properties in CSSStyleDeclaration and stylesheets.MediaQuery
CSSValue: | A CSS value which might also be a CSSPrimitiveValue or CSSValueList.
CSSComment: | A comment anywhere in the stylesheet. Not in any official spec.

## Shared Attributes

cssText
  The textual representation of the rule or sheet (cssutils defined this property for CSSStyleSheet objects too).
atkeyword
  All @rules have this attribute which holds the literal atkeyword, e.g. `@im\port`.

## CSSStyleSheet

The CSSStyleSheet contains all rules. It consists of the different rules defined above like CSSImportRule CSSStyleRule etc. It also defines the encoding of the style sheet used for serialization. The encoding might by set with an CSSCharsetRule rules or simpler with the encoding attribute. The serialized sheet may be obtained from cssText. All rules are present in cssRules. Namespace prefixes are available in prefixes, the actual namespace URIs in the CSSNamespaceRule objects (do not rely on prefixes though, see http://www.w3.org/TR/REC-xml-names/ how these work.

### Attributes

Also inherits properties from stylesheet.StyleSheet.

cssRules
  of type CSSRuleList, (DOM readonly)
ownerRule
  of type CSSRule, readonly (NOT IMPLEMENTED YET)

encoding (cssutils and CSSOM only)

  reflects the encoding of an @charset rule or 'utf-8' (default) if set to `None`.

  Effectively using CSSCharsetRule directly is not needed anymore.

prefixes: set (cssutils only)
  A set of declared prefixes via @namespace rules. Each CSSStyleRule is checked if it uses additional prefixes which are not declared. If they do they are "invalidated".

## CSSCharsetRule

This rule is not really needed anymore as using encoding of CSSStyleSheet is much easier.

## CSSNamespaceRule

CSSNamespaceRule currently implements http://www.w3.org/TR/2006/WD-css3-namespace-20060828/

namespaceURI
  The namespace URI (a simple string!) which is bound to the given prefix. If no prefix is set (CSSNamespaceRule.prefix=='') the namespace defined by `namespaceURI` is set as the default namespace.
prefix
  The prefix used in the stylesheet for the given CSSNamespaceRule.nsuri. If prefix is empty uri sets the default namespace for the stylesheet.

## CSSImportRule

Used to import other CSS style sheets.

href
  The URI where the referenced sheet may be found. May be a string or `url()` value.
media
  The media information where the referenced style sheet should be used. See MediaList for more details.
stylesheet
  The referenced CSSStyleSheet. Currently always `None` as it is not implemented.

## CSSMediaRule

tbd

## CSSFontFaceRule

tbd

## CSSPageRule

## CSSStyleRule

tbd