[whatwg] Accept full CSS colors in the legacy color parsing algorithm
Tab Atkins Jr.
jackalmage at gmail.com
Fri Apr 8 13:54:11 PDT 2011
In the legacy color parsing algorithm
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. Instead of steps 5 and 6, we
just try to parse it as a CSS color. If we succeed, we use that
color. Otherwise, we chunk it into the legacy parsing algorithm and
do what the spec says. So, for example, <font
color=rgba(255,0,0,.5)>foo</font> is actually displayed as
partially-transparent red instead of dark green (following the
algorithm mangles the string into #050).
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.)
More information about the whatwg