W3C home > Mailing lists > Public > www-style@w3.org > February 2012

Re: [css3-values] RE: CSSStyleDeclaration#length and shorthands.

From: Glenn Adams <glenn@skynav.com>
Date: Wed, 1 Feb 2012 09:08:50 -0700
Message-ID: <CACQ=j+dxeBLWRoQaABFbYGk6vX1WvHmjXN3OwbLveGnxJU8SiQ@mail.gmail.com>
To: Shane Stephens <shans@google.com>
Cc: www-style@w3.org
On Tue, Jan 31, 2012 at 11:36 PM, Shane Stephens <shans@google.com> wrote:

> Coming in a bit late here, I thought maybe I could try to summarize the
> issues:
>

there is also the issue of what point in the property resolution process
should be used to obtain the exposed values

if I may be allowed to review the current specs, there appear to be two,
three, or four flavors (depending on how you count) of CSSStyleDeclaration
exposed by the CSSOM (quoted text is from DOM2 Style):

(1) {CSSStyleRule,CSSPageRule,CSSFontFaceRule}.style [in DOM2 Style and
CSSOM ED]

style of type CSSStyleDeclaration<http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration>,
readonly The *declaration-block*<http://www.w3.org/TR/1998/REC-CSS2-19980512/syndata.html#q8>
of
this rule set.

the intent here seems to be focused on representing the content of the
source declaration block more than representing any point in the property
resolution process; that is, in representing a property resolution state
*prior* to cascading, absolutization, etc.;

in this case, it seems more natural for length/item to reflect only those
syntactic items found in the declaration block;

(2) ElementCSSInlineStyle.style [in DOM2 Style and CSSOM ED]

This represents the contents of the
*STYLE*<http://www.w3.org/TR/1998/REC-html40-19980424/present/styles.html#h-14.2.2>
 attribute for HTML elements (or elements in other schemas or DTDs which
use the STYLE attribute in the same way).

style of type CSSStyleDeclaration<http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration>,
readonly The style attribute.

the intent here seems to be focused on representing the content of the
source style attribute more than representing any point in the property
resolution process; that is, in representing a property resolution state
*prior* to cascading, absolutization, etc.;

since this appears to be closely related to the intent of item (1) above,
it is perhaps the case that (1) and (2) should be grouped into a single
flavor (category) of usage of CSSStyleDeclaration;

again, since this use of CSSStyleDeclaration is supposed to correspond to
the syntactic content of the style attribute, it seems more natural for
length/item to reflect only those syntactic items found in the declaration
block, i.e., if only a single shorthand is returned by cssText one would
tend to expect length of 1, and not 4 (longhands only) or 5 (shorthand +
longhands);

(3) DocumentCSS.getOverrideStyle() [in DOM2 Style, but not in CSSOM ED]

The getOverrideStyle method provides a mechanism through which a DOM author
could effect immediate change to the style of an element without modifying
the explicitly linked style sheets of a document or the inline style of
elements in the style sheets. This style sheet comes after the author style
sheet in the cascade algorithm and is called *override style sheet*. The
override style sheet takes precedence over author style sheets.
*
*
*Return Value*

CSSStyleDeclaration<http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration>

The override style declaration.

this usage also seems oriented more towards a syntactic representation of a
declaration block composing an override style sheet, so it may also be
grouped with (1) or with (1) and (2);

this mechanism does not appear in the current CSSOM ED, and no explanation
is offered, but see [1]; a quick check on {Safari, Opera, FF} shows that
only Safari has a binding for document.getOverrideStyle(), but returns null
for all elements, so it appear to be nothing more than a stub;

[1] http://lists.w3.org/Archives/Public/www-style/2007Feb/0150.html

IE has Element.runtimeStyle, which seems akin to getOverrideStyle() but
doesn't return a CSSStyleDeclaration and more importantly does not
represent an override style sheet as such, but represents the
cascaded/formatted property state

(4) ViewCSS.getComputedStyle() [in DOM2 Style and CSSOM ED (but moved to
Window, eliding ViewCSS)]

This interface represents a CSS view. The getComputedStyle method provides
a *read only access* to the *computed
values*<http://www.w3.org/TR/1998/REC-CSS2-19980512/cascade.html#computed-value>
of
an element.
*
*
*Return Value*

CSSStyleDeclaration<http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration>

The computed style. The
CSSStyleDeclaration<http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration>
is
read-only and contains only absolute values.

this facility provides *read-only* access to the results of property
resolution, thus representing the results of cascading and absolutization,
but not formatting;

the current CSSOM ED changes these semantics to use the newly defined
"resolved value" category rather than computed values, where resolved value
is either the computed value or the used value, depending on the property;
as such, this redefinition amounts to changing getComputedStyle() to return
the results of cascading, absolutization, *and* formatting; but note this
still does not necessarily represent "actual" values (e.g., having applied
device specific realizations of colors, grid fitting, etc);

it is clear that the CSSStyleDeclaration returned by getComputedStyle() is
not intended to represent a syntactic CSS declaration block but rather is
intended to represent internal UA formatting state, albeit in a read-only
manner;

clearly this usage is oriented towards longhand properties, and i would not
expect to see any shorthand properties listed;
Received on Wednesday, 1 February 2012 16:09:41 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:50 GMT