[whatwg] Inconsistency between canvas and CSS color serialization

Boris Zbarsky bzbarsky at MIT.EDU
Thu Feb 3 11:17:56 PST 2011


On 2/3/11 1:58 PM, Tab Atkins Jr. wrote:
> 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.

I'm not sure it's that simple.

In particular, the way browsers actually _store_ the alpha value is not 
as an infinite-precision decimal (which is what <number> is in CSS).

For example, in the case of Gecko the alpha value is stored as an 
integer in the range [0,255].  When serializing we do a floating-point 
division by 255 and then try to make the result not have 6 useless 
significant figures (in fact I believe we always output either 2 or 3).

This is quite different from other <number> uses....

-Boris


More information about the whatwg mailing list