CSSOM Values Module

[LONGSTATUS] [DATE: 3 August 2002]

This Version:
www-style@w3.org (archives)
File a bug (open bugs)
IRC: #css on W3C
Latest Version:
Latest Editor's draft:
Previous Version:
Simon Pieters (Opera Software ASA) <simonp@opera.com>
Glenn Adams (Cox Communications, Inc.) <glenn.adams@cox.com>


This CSSOM Values module defines APIs for accessing and manipulating CSS property values using object oriented value representations. These APIs are intended to replace the underimplemented and underutilized CSSValue and related APIs defined by DOM2STYLE.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This is the [DATE: 3 August 2002] [LONGSTATUS] of CSSOM. Please send comments to www-style@w3.org (archived) with [cssom-values] at the start of the subject line.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

Table of Contents


This CSSOM Values module defines APIs for accessing and manipulating CSS property values using object oriented value representations.


All diagrams, examples, and notes in this specification are non-normative, as are all sections explicitly marked non-normative. Everything else in this specification is normative.

The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC2119. For readability, these words do not appear in all uppercase letters in this specification. RFC2119

Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and terminate these steps") are to be interpreted with the meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.

Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be easy to follow, and not intended to be performant.)

Unless otherwise stated, string comparisons are done in a case-sensitive manner.


This specification relies upon the following underlying specifications:


A conforming user agent must support the CSS Object Model. CSSOM

Narrow this dependency to specific features of CSSOM.

CSS Values

The CSSValue Interface

interface CSSValue {
  // ...

The CSSStyleDeclaration Interface

partial interface CSSStyleDeclaration {
  readonly attribute CSSStyleDeclarationValue values;


The CSSStyleDeclarationValue Interface

interface CSSStyleDeclarationValue {
  // CSS Properties


The rough idea is that this interface exposes the full list of supported properties as well that each return a CSSPropertyValue object. That object can implement other objects depending on the property involved. E.g. for 'width' the object would implement CSSLengthComponentValue and CSSPercentageComponentValue.

The CSSPropertyValue Interface

interface CSSPropertyValue {
           attribute DOMString cssText;


The CSSPropertyValueList Interface

[NoInterfaceObject] interface CSSPropertyValueList {
  readonly attribute CSSValue[] list;


Ideally this attribute just returns a mutable array.

The CSSMapValue Interface

[NoInterfaceObject] interface CSSMapValue {
  getter CSSValue (DOMString name);

This seems the simplest we can get away with.

The CSSComponentValue Interface

[NoInterfaceObject] interface CSSComponentValue {
  readonly attribute DOMString type;
           attribute any value;



type returns "string", "keyword", "identifier", "color", "em", "ex", "px", "url".

The CSSColorComponentValue Interface

[NoInterfaceObject] interface CSSColorComponentValue {
           attribute short red;
           attribute short green;
           attribute short blue;
           attribute float alpha;





We can make this more complex later. This will probably move into the CSS Color Level 4.

The CSSIdentifierComponentValue Interface

[NoInterfaceObject] interface CSSIdentifierComponentValue {
           attribute DOMString identifier;


The CSSKeywordComponentValue Interface

[NoInterfaceObject] interface CSSKeywordComponentValue {
           attribute DOMString keyword;


The CSSLengthComponentValue Interface

[NoInterfaceObject] interface CSSLengthComponentValue {
           attribute float em;
           attribute float ex;
           attribute float px;
           // figure out what to do with absolute lengths




The CSSPercentageComponentValue Interface

[NoInterfaceObject] interface CSSPercentageComponentValue {
           attribute float percent;


The CSSStringComponentValue Interface

[NoInterfaceObject] interface CSSStringComponentValue {
           attribute DOMString string;


The CSSURLComponentValue Interface

[NoInterfaceObject] interface CSSURLComponentValue {
           attribute DOMString? url;




The editors would like to thank Alexey Feldgendler, Björn Höhrmann, Brian Kardell, Christian Krebs, Daniel Glazman, David Baron, fantasai, Hallvord R. M. Steen, Ian Hickson, John Daggett, Lachlan Hunt, Morten Stenshorne, Philip Taylor, Robert O'Callahan, Sjoerd Visscher, Sylvain Galineau, Tarquin Wilton-Jones, and Zack Weinberg for contributing to this specification.

Special thanks to Anne van Kesteren who authored the material upon which this work is based.