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

Re: [cssom] comments on value serialization rules

From: Anne van Kesteren <annevk@opera.com>
Date: Thu, 18 Feb 2010 15:00:06 +0100
To: "L. David Baron" <dbaron@dbaron.org>, www-style@w3.org
Message-ID: <op.u8bs6gru64w2qv@annevk-t60>
On Wed, 17 Feb 2010 19:21:14 +0100, L. David Baron <dbaron@dbaron.org>  
> Various comments on the value serialization rules in:
>   http://dev.w3.org/csswg/cssom/#serializing-css-values
> follow.

Thanks, much appreciated!

> For <angle>, <frequency>, <length>, <resolution>, and <time>, Gecko
> currently preserves the unit the author specified.  I'm ok with
> normalizing to a single unit, although I worry about two things:
>  * compatibility issues
>  * choice of what the canonical unit is
> In particular, I suspect serializing '12pt' to '4.2333mm' might lead
> to confusion, though maybe it would be good that authors learn that
> 'pt' are physical units.

This might go a way if physical units are going to be defined in terms of  
CSS pixels.

> The escaping rules presented for <string> and <uri> have bugs in
> that they produce values that don't round-trip correctly (e.g.,
> values with \n or \r in them, or values with \ in them).  I'd
> propose fixing that the way I did in Gecko, and also generally
> making the escaping rules for <identifier> more similar to those for
> <string> and <uri>, by making them as follows:

I used these rules, thanks!

>   Define "escape as an string" as a string represented by the
>   concatenation of, for each character:
>    * if the character is in the range U+0000 to U+001F, the
>      character serialized as a codepoint escape
>    * if the character is '"' (U+0022), "'" (U+0027),  or '\'
>      (U+005C), the character serialized as a character escape
>    * otherwise, the character itself

Do you think we can leave U+0027 out if we ensure that strings always end  
up between double quotes?

> These rules also have the advantages that they minimize the use of
> codepoint escapes (generally quite ugly due to the
> space-as-terminator) to ASCII nonprintables and escaping of digits,
> and that they escape all ASCII nonprintables (which could otherwise
> be quite confusing to read).
> Then <uri> and <string> can refer to "escape as a string" and
> <identifier> can refer to "escape as an identifier".


> Also, <uri> should end with '")' rather than ')"'.

Yeah, I noticed this while reading the example during the teleconference  
yesterday, fixed :-)

> For <color>, what Gecko does, I believe, is that it handles system
> colors, color keywords, and 'currentColor' like <keyword>, but
> handles 'transparent', 'rgb()', 'rgba()', 'hsl()', 'hsla()', '#rgb',
> and '#rrggbb' as color values which are serialized as follows:
>  * 'transparent' when R, G, B, and A components are all 0
>  * as 'rgb()' when A component is 255
>  * as 'rgba()' otherwise
> I'm not particularly committed to keeping it that way, though.
> However, I'm somewhat concerned about the idea of switching to
> #rrggbb notation since rgb() can handle out-of-sRGB values whereas
> #rrggbb cannot.  (Gecko doesn't currently implement that, but I'd
> like to.)

And then sometimes serialize to percentages? Or would you propose a change  
to the rgb() syntax as well? My main gripe here is <canvas> which uses  
#rrggbb and IE, which also uses #rrggbb (though I should probably test  
that again to be sure).

> Also, the title of the section following is misspelled
> ("Declaraton" needs an i).

Also fixed!

Anne van Kesteren
Received on Thursday, 18 February 2010 14:00:47 UTC

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