W3C home > Mailing lists > Public > www-style@w3.org > September 2013

Re: [cssom] Computing & Serializing functional notation values with optional parameters

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 30 Sep 2013 14:17:15 -0700
Message-ID: <CAAWBYDAe5Hr742b_oj-9hZ3_XzxnYnWxh0OQ5AD=a9eFsfu_MQ@mail.gmail.com>
To: Bear Travis <betravis@adobe.com>
Cc: "www-style@w3.org" <www-style@w3.org>
On Mon, Sep 30, 2013 at 2:02 PM, Bear Travis <betravis@adobe.com> wrote:
> Hi All,
>
> I was recently wondering about how best to compute and serialize basic css
> shapes [1], which take a functional notation form which has optional
> parameters. This is similar in some ways to transform functions like
> translate, which take an optional second parameter [2]. Dirk Schulze
> suggested that both the computed and serialized values be resolved "as
> specified" [3], but we were having trouble pin-pointing exactly where such
> behavior was defined. A functional value serializing "as specified" would
> mean that it prints out the function with the same arguments specified by
> the author, while cleaning up whitespace and comments.
>
> For example:
> var div = document.createElement('div');
> div.style.transform = 'translate(/* I am a comment */    1em    )'
> console.log(div.style.transform)
>
> Would log 'translate(1em)' rather than echoing the css text, or adding a
> value for the optional second parameter.
>
> The transforms property also has a computed value "as specified" [4], which
> implies that the computed value will have the same number of arguments as
> the author style, but some of those values may be computed. If you continued
> the above example to:
> document.body.appendChild(div);
> console.log(getComputedStyle(div).transform);
>
> You would log 'translate(16px)' rather than 'translate(16px, 0px)'.
>
> Does anyone know where such behavior is defined, and if it make sense for
> Basic CSS Shapes [5]?

Some of this falls out of the definition of parsing in the Syntax
spec, where whitespace is collapsed and comments are elided.  In
general, though, serialization of CSS values is still very
underdefined, unfortunately.

~TJ
Received on Monday, 30 September 2013 21:18:01 UTC

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