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

Re: [cssom] draft of color serialization rules

From: Glenn Adams <glenn@skynav.com>
Date: Tue, 2 Oct 2012 11:00:49 +0800
Message-ID: <CACQ=j+cY8OYhJY7yOoFc1VFChrrnoDQ1afpSd2s8iDzKhMOz1Q@mail.gmail.com>
To: Sylvain Galineau <sylvaing@microsoft.com>
Cc: W3C Style <www-style@w3.org>
On Tue, Oct 2, 2012 at 8:51 AM, Sylvain Galineau <sylvaing@microsoft.com>wrote:

> >I've drafted language describing color serialization rules at [1][2].
> Please review and comment.
> >[1] https://dvcs.w3.org/hg/csswg/rev/0d2a6c814dd1
> >[2]
> http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html#serializing-css-values
> If the goal of defining a common serialization is to enable authors to
> write cross-browser OM
> parsing code reliably, wouldn't it easier for them if the value was always
> returned as rgba(),
> even when the alpha is 1? From an 'aesthetic' standpoint - e.g. what I
> want to see in browser
> dev tools - the behavior you specified makes sense. It also saves a few
> bytes in the common
> case. But for anyone consuming the value for parsing it's yet another step.

The question is how much to we want to break working pages/content? For
example, if I thought that were feasible, I would specify that no space
followed commas, e.g., rgb(0,0,0) instead of rgb(0, 0, 0).

However, my understanding of the goals of CSSOM is that, all things
considered, it should try to capture current practice when it appears there
is significant consensus towards a common behavior. At present, that common
behavior seems use rgb() rather than rgba() for opaque colors.

Frankly, I'm more concerned about defining the value returned for specified
values rather than computed values. What degree of canonicalization do we
want for serialization of non-computed, but specified value, e.g., should
the following hold (for specified style set/get)? Or should some
canonicalization apply?

elt.style.color = 'black';
elt.style.color = '#000';
elt.style.color = '#000000';
elt.style.color = 'rgb(0,0,0)';
elt.style.color = 'rgb(0, 0, 0)';
assert_equals(elt.style.color,'rgb(0, 0, 0)');
elt.style.color = 'rgba(0,0,0,0)';
elt.style.color = 'rgba(0, 0, 0, 0)';
assert_equals(elt.style.color,'rgba(0, 0, 0, 0)');
Received on Tuesday, 2 October 2012 03:01:36 UTC

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