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: Tue, 31 Jan 2012 23:13:18 -0700
Message-ID: <CACQ=j+dZdGtRv=1B85cmeZ2fjJdnDU_WzpSJwJEUFSa+uTov5Q@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style@w3.org
On Tue, Jan 31, 2012 at 9:49 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 1/31/12 11:40 PM, Glenn Adams wrote:
>> Three UAs retain the original cssText, excepting Safari which translates
>> to the longhand properties only.
> Your test doesn't show that, actually.  What it _does_ show is that at
> least three UAs try to produce shorthands in cssText.
> I know for a fact that Gecko does NOT retain the original cssText here.
>  It stores longhands internally, and tries to produce the shortest text
> representation it can for cssText.

"retain" here simply means that the output is equal to the input; it
matters not what internal transformation occurs;

The only way to tell what UAs are really doing here is to try multiple
> different values of the original cssText and see what happens to it.  In
> addition to the shorthand you tried, you should also try "border-top-width:
> 2px; border-right-width: 4px; border-bottom-width: 2px; border-left-width:
> 4px" (which won't change the output in gecko and WebKit; not sure about the
> others), and perhaps things like "border-width: 3px 4px;
> border-bottom-width: 2px; border-top-width: 2px" and so forth....

i'm not trying to tell what UAs are "really doing" under the covers, just
try a simple example to see what variations hold from a black box

>  Three UAs also report 4 items, including those that return only one
>> shorthand property in cssText.
> The only reason Gecko reports more than 4 is that our implementation of
> border-start and border-end involves a few extra longhand properties
> dealing with border widths, and the border-width shorthand sets those
> additional longhand properties.

ok; it is clear that neither DOM2 Style nor CSSOM make clear what is
intended to be reported via length/item(); however, one does wonder about
the language in DOM2 Style

Used to retrieve the properties that have been explicitly set in this
declaration block. The order of the properties retrieved using this method
does not have to be the order in which they were set. This method can be
used to iterate over all properties in this declaration block.

combined with the language that

cssText of type DOMString The parsable textual representation of the
declaration block (excluding the surrounding curly braces).

a more simple reading would be that length/item() should correspond only to
those declarations present in the value of cssText, since both ostensibly
represent "the declaration block"

it would be nice if we could dredge up what was intended by the phrase
"explicitly set" in the above; the text doesn't elaborate, so it is
anyone's guess at this point
Received on Wednesday, 1 February 2012 06:14:06 UTC

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