CSSOM Values Module

[LONGSTATUS] [DATE: 3 August 2002]

This Version:
http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-values/Overview.html
[VERSION]
Participate:
www-style@w3.org (archives)
File a bug
IRC: #css on Freenode
Latest Version:
[LATEST]
Latest Editor's draft:
http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-values/Overview.html
Previous Version:
Editors:
Glenn Adams (Cox Communications, Inc.) <glenn.adams@cox.com>
Shane Stephens (Google, Inc.) <shans@google.com>

Abstract

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

Introduction

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

Conformance

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.

Dependencies

This specification relies upon the following underlying specifications:

CSSOM

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

Narrow this dependency to specific features of CSSOM.

CSS Values

The CSSStyleDeclaration Interface

partial interface CSSStyleDeclaration {
  readonly attribute CSSStyleDeclarationValue values;
};

The CSSStyleDeclarationValue Interface

interface CSSStyleDeclarationValue {
  // CSS Properties
  readonly attribute CSSPropertyValue azimuth;
  readonly attribute CSSPropertyValue background;
  readonly attribute CSSPropertyValue backgroundAttachment;
  readonly attribute CSSPropertyValue backgroundColor;
  readonly attribute CSSPropertyValue backgroundImage;
  readonly attribute CSSPropertyValue backgroundPosition;
  readonly attribute CSSPropertyValue backgroundRepeat;
  readonly attribute CSSPropertyValue border;
  readonly attribute CSSPropertyValue borderCollapse;
  readonly attribute CSSPropertyValue borderColor;
  readonly attribute CSSPropertyValue borderSpacing;
  readonly attribute CSSPropertyValue borderStyle;
  readonly attribute CSSPropertyValue borderTop;
  readonly attribute CSSPropertyValue borderRight;
  readonly attribute CSSPropertyValue borderBottom;
  readonly attribute CSSPropertyValue borderLeft;
  readonly attribute CSSPropertyValue borderTopColor;
  readonly attribute CSSPropertyValue borderRightColor;
  readonly attribute CSSPropertyValue borderBottomColor;
  readonly attribute CSSPropertyValue borderLeftColor;
  readonly attribute CSSPropertyValue borderTopStyle;
  readonly attribute CSSPropertyValue borderRightStyle;
  readonly attribute CSSPropertyValue borderBottomStyle;
  readonly attribute CSSPropertyValue borderLeftStyle;
  readonly attribute CSSPropertyValue borderTopWidth;
  readonly attribute CSSPropertyValue borderRightWidth;
  readonly attribute CSSPropertyValue borderBottomWidth;
  readonly attribute CSSPropertyValue borderLeftWidth;
  readonly attribute CSSPropertyValue borderWidth;
  readonly attribute CSSPropertyValue bottom;
  readonly attribute CSSPropertyValue captionSide;
  readonly attribute CSSPropertyValue clear;
  readonly attribute CSSPropertyValue clip;
  readonly attribute CSSPropertyValue color;
  readonly attribute CSSPropertyValue content;
  readonly attribute CSSPropertyValue counterIncrement;
  readonly attribute CSSPropertyValue counterReset;
  readonly attribute CSSPropertyValue cue;
  readonly attribute CSSPropertyValue cueAfter;
  readonly attribute CSSPropertyValue cueBefore;
  readonly attribute CSSPropertyValue cursor;
  readonly attribute CSSPropertyValue direction;
  readonly attribute CSSPropertyValue display;
  readonly attribute CSSPropertyValue elevation;
  readonly attribute CSSPropertyValue emptyCells;
  readonly attribute CSSPropertyValue cssFloat;
  readonly attribute CSSPropertyValue font;
  readonly attribute CSSPropertyValue fontFamily;
  readonly attribute CSSPropertyValue fontSize;
  readonly attribute CSSPropertyValue fontSizeAdjust;
  readonly attribute CSSPropertyValue fontStretch;
  readonly attribute CSSPropertyValue fontStyle;
  readonly attribute CSSPropertyValue fontVariant;
  readonly attribute CSSPropertyValue fontWeight;
  readonly attribute CSSPropertyValue height;
  readonly attribute CSSPropertyValue left;
  readonly attribute CSSPropertyValue letterSpacing;
  readonly attribute CSSPropertyValue lineHeight;
  readonly attribute CSSPropertyValue listStyle;
  readonly attribute CSSPropertyValue listStyleImage;
  readonly attribute CSSPropertyValue listStylePosition;
  readonly attribute CSSPropertyValue listStyleType;
  readonly attribute CSSPropertyValue margin;
  readonly attribute CSSPropertyValue marginTop;
  readonly attribute CSSPropertyValue marginRight;
  readonly attribute CSSPropertyValue marginBottom;
  readonly attribute CSSPropertyValue marginLeft;
  readonly attribute CSSPropertyValue markerOffset;
  readonly attribute CSSPropertyValue marks;
  readonly attribute CSSPropertyValue maxHeight;
  readonly attribute CSSPropertyValue maxWidth;
  readonly attribute CSSPropertyValue minHeight;
  readonly attribute CSSPropertyValue minWidth;
  readonly attribute CSSPropertyValue orphans;
  readonly attribute CSSPropertyValue outline;
  readonly attribute CSSPropertyValue outlineColor;
  readonly attribute CSSPropertyValue outlineStyle;
  readonly attribute CSSPropertyValue outlineWidth;
  readonly attribute CSSPropertyValue overflow;
  readonly attribute CSSPropertyValue padding;
  readonly attribute CSSPropertyValue paddingTop;
  readonly attribute CSSPropertyValue paddingRight;
  readonly attribute CSSPropertyValue paddingBottom;
  readonly attribute CSSPropertyValue paddingLeft;
  readonly attribute CSSPropertyValue page;
  readonly attribute CSSPropertyValue pageBreakAfter;
  readonly attribute CSSPropertyValue pageBreakBefore;
  readonly attribute CSSPropertyValue pageBreakInside;
  readonly attribute CSSPropertyValue pause;
  readonly attribute CSSPropertyValue pauseAfter;
  readonly attribute CSSPropertyValue pauseBefore;
  readonly attribute CSSPropertyValue pitch;
  readonly attribute CSSPropertyValue pitchRange;
  readonly attribute CSSPropertyValue playDuring;
  readonly attribute CSSPropertyValue position;
  readonly attribute CSSPropertyValue quotes;
  readonly attribute CSSPropertyValue richness;
  readonly attribute CSSPropertyValue right;
  readonly attribute CSSPropertyValue size;
  readonly attribute CSSPropertyValue speak;
  readonly attribute CSSPropertyValue speakHeader;
  readonly attribute CSSPropertyValue speakNumeral;
  readonly attribute CSSPropertyValue speakPunctuation;
  readonly attribute CSSPropertyValue speechRate;
  readonly attribute CSSPropertyValue stress;
  readonly attribute CSSPropertyValue tableLayout;
  readonly attribute CSSPropertyValue textAlign;
  readonly attribute CSSPropertyValue textDecoration;
  readonly attribute CSSPropertyValue textIndent;
  readonly attribute CSSPropertyValue textShadow;
  readonly attribute CSSPropertyValue textTransform;
  readonly attribute CSSPropertyValue top;
  readonly attribute CSSPropertyValue unicodeBidi;
  readonly attribute CSSPropertyValue verticalAlign;
  readonly attribute CSSPropertyValue visibility;
  readonly attribute CSSPropertyValue voiceFamily;
  readonly attribute CSSPropertyValue volume;
  readonly attribute CSSPropertyValue whiteSpace;
  readonly attribute CSSPropertyValue widows;
  readonly attribute CSSPropertyValue width;
  readonly attribute CSSPropertyValue wordSpacing;
  readonly attribute CSSPropertyValue zIndex;
};

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;
};

References

Normative references

Informative references

Acknowledgments

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, Simon Pieters, Sylvain Galineau, Tarquin Wilton-Jones, and Zack Weinberg for contributing to this specification.