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

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

From: Glenn Adams <glenn@skynav.com>
Date: Tue, 31 Jan 2012 13:05:05 -0700
Message-ID: <CACQ=j+dTYCb9z-AXv2v=0uLgzpJDeBUo6kJb-E=42DbP2FNbKQ@mail.gmail.com>
To: Brian Manthos <brianman@microsoft.com>
Cc: Alexis Menard <alexis.menard@openbossa.org>, "www-style@w3.org" <www-style@w3.org>
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.


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

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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:10 UTC