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

On Tue, Jan 31, 2012 at 12:41 PM, Brian Manthos <brianman@microsoft.com>wrote:

> Alexis:
> > Given this example : <div style="border-width: 1px 2px 3px
> > 4px;"></div>. What would be the length of the style for the div?
> >
> > - 4 ? (border-top-width, border-right-width, border-bottom-width,
> > border-left-width)
> > - 5 ? (border-top-width, border-right-width, border-bottom-width,
> > border-left-width, border-width)
>
> I believe the length should be 5.
>
> border-top-width: 1px;
> border-right-width: 2px;
> border-bottom-width: 3px;
> border-left-width: 4px;
> border-width: 1px 2px 3px 4px;
>

I would expect the length to be 1, and that cssText return "border-width:
1px 2px 3px 4px". My rationale is based on the following language in DOM2
Style which is not further elaborated in CSSOM (at present):

length of type unsigned long, readonly The number of properties that have
been explicitly set in this declaration block. The range of valid indices
is 0 to length-1 inclusive.

and

When dealing with CSS "shorthand" properties, the shorthand properties
should be decomposed into their component longhand properties as
appropriate, and when querying for their value, the form returned should be
the shortest form exactly equivalent to the declarations made in the ruleset.
However, if there is no shorthand declaration that could be added to the
ruleset without changing in any way the rules already declared in the
ruleset (i.e., by adding longhand rules that were previously not declared
in the ruleset), then the empty string should be returned for the shorthand
property.

On the other hand, if this CSSStyleDeclaration were returned from
getComputedStyle(...), I would expect length 4, with items being

border-top-width: 1px;
border-right-width: 2px;
border-bottom-width: 3px;
border-left-width: 4px;

Received on Tuesday, 31 January 2012 20:05:53 UTC