[whatwg] Inconsistency between canvas and CSS color serialization
bzbarsky at MIT.EDU
Thu Feb 3 10:55:21 PST 2011
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,
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 colors?
More information about the whatwg