W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2011

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 8 Apr 2011 13:54:11 -0700
Message-ID: <BANLkTi=4cTDgDZi8011i9DotyGeQtdNjHw@mail.gmail.com>
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.)

Received on Friday, 8 April 2011 13:54:11 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:05 UTC