W3C home > Mailing lists > Public > www-dom@w3.org > January to March 1999

Re: DOM CSS

From: Vidur Apparao <vidur@netscape.com>
Date: Fri, 12 Feb 1999 13:05:50 -0800
Message-ID: <36C497AE.CA45E2EA@netscape.com>
To: "L. David Baron" <dbaron@fas.harvard.edu>
CC: www-dom@w3.org


"L. David Baron" wrote:

> Section 1.2: interface StyleSheet
>
>   Perhaps the definition of the title attribute should mention the
>   complexity of the use of titles for sets of stylesheets as
>   described in HTML40, section 14.3. [2]

We discussed this and decided that this description was best left to the HTML
4.0 spec (which is referenced in the text for the title attribute).

> Section 1.3: interface CSSStyleDeclaration
>
>   How do the functions in CSSStyleDeclaration handle shorthand
>   properties [3] (e.g., margin)?  I think the shorthand properties
>   should be treated as decomposed into their full representations.
>   This implies that when the related longhand properties (i.e.,
>   margin-top, etc.) are retrieved, they are all correct.  When the
>   longhand properties are set, the results are as expected, since the
>   properties previously set on the shorthand properties and not changed
>   will stay unchanged, but the property that was changed should be
>   changed.  When the shorthand properties are set, all the longhand
>   properties of which they are composed are set/reset (per CSS spec).
>   (I think this was likely understood by the authors, but I think it
>   deserves mention.)
>
>   For example, if the margin property is set to "1em 2em 3em 4em"
>   (meaning top, right, bottom, and left margins),
>   getPropertyValue("margin-left") should return "4em".
>   If one then calls setProperty("margin-top", "0", ""), then I think
>   getPropertyValue("margin") should return "0 2em 3em 4em".

Thank you for bringing up this issue. It was definitely not addressed in the
working draft and should be. After talking about it, we came up with the
following rules (which I believe are in sync with your suggestions):
1) If a shorthand property is set, it explicitly sets all of the longhand
properties. For example, if you set the CSS font property to "14pt Arial",
querying the font-weight property will result in a value of "normal".
2) If not all longhand properties have been explicitly set, querying the
shorthand property should return the empty string.
3) When computing the shorthand property, only non-defaulted longhand property
values should be listed. For example, querying for the font property should not
return "normal normal normal 14pt/normal Arial", since the "normal"s are default
values.


>   Question:  Is it within the scope of the DOM to specify that some
>   arguments to functions should be optional??  If so, I think priority
>   on CSSStyleDeclaration::setProperty should be.

Optional arguments aren't allowed in Corba IDL. It may be possible to specify
arguments as optional in the ECMAScript binding. We've chosen not to do so thus
far, so as to keep the different bindings reasonably similar.

> Section 1.4: interface CSS2Properties
>
>   Question: is there an attribute of type CSS2Properties in the
>   interface CSS2StyleDeclaration?  Or is it not mentioned because it
>   is optional?

The following text was added to the spec as part of the second paragraph in the
description of the CSS2Properties interface:

   If this interface is implemented, the expectation is that binding-specific
   casting methods may be used to convert from a reference to
   CSSStyleDeclaration to a reference to CSS2Properties.

The expectation is that the "style" attribute of a CSSStyleRule can be "cast" to
a CSS2Properties reference in a binding specific manner. For Java this may
involve an instanceof check prior to an actual cast. In COM, this would require
a QueryInterface. No casting would be required in ECMAScript.

Note that, in the future, we may split the CSS2Properties interface into
different interfaces that map to the proposed CSS modules division.

--Vidur
Received on Friday, 12 February 1999 16:01:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT