[whatwg] Accept full CSS colors in the legacy color parsing algorithm

Boris Zbarsky bzbarsky at MIT.EDU
Fri Apr 8 14:26:39 PDT 2011


On 4/8/11 1:54 PM, Tab Atkins Jr. wrote:
> In the legacy color parsing algorithm
> <http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#rules-for-parsing-a-legacy-color-value>,
> steps 5 and 6 concern CSS color names - 'transparent' should raise an
> error, and color names should be respected.  All other CSS color
> syntaxes, though, such as the rgba() function, are just passed through
> to the rest of the algorithm and appropriately mangled.
>
> This doesn't match Webkit's behavior.

But it does match other UAs....

> Could we change those two steps to just say "If keyword is a valid CSS
> color value, then return the simple color corresponding to that
> value."?  (I guess, to fully match Webkit, you need to change the
> definition of "simple color" to take alpha into account.)

Do you have web compat data here?

I would much rather stick with color parsing as defined in HTML4 modulo 
the "not a color name, treat it as a hex color even if it doesn't start 
with '#'" quirk than replace the "is it a color name?" test with a "does 
it parse as a CSS color?" test.

-Boris



More information about the whatwg mailing list