[whatwg] Inconsistency between canvas and CSS color serialization
Tab Atkins Jr.
jackalmage at gmail.com
Thu Feb 3 10:58:30 PST 2011
On Thu, Feb 3, 2011 at 10:55 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
> It looks like CSS rgba colors with an alpha value of 0 are serialized as
> rgba() with "0" as the alpha value. in at least Gecko, Webkit, and Presto.
> It also looks like canvas style color with an alpha value of 0 are
> serialized as rgba() with "0.0" as the alpha value in Gecko 3.6, Webkit, and
> In Gecko 2.0 we made a change to the canvas code to fix some bugs in the
> serialization by the simple expedient of reusing the well-tested code that
> CSS colors use. This has the incidental benefit of more behavior
> consistency for authors. Unfortunately, this makes us not do what these
> other UAs do, nor do what the current spec draft says.
> While we can clearly special-case 0 in this code, it seems like an authoring
> pitfall to have the two different serialization styles, so I would prefer to
> have consistent behavior between the two. What do other UA vendors think of
> standardizing on "0" as the serialization for canvas color alpha channels
> when they're transparent? Alternately, what about using "0.0" for CSS
The alpha value is just a <number>, so whatever we decide on, we
should make the standard serialization for <number> and document it in
the CSSOM. (Right now CSSOM just has a note that browsers seem to use
toString to serialize <number>s.)
I have no preference either way.
More information about the whatwg