[whatwg] Color attributes
zcorpan at gmail.com
Mon Sep 17 09:58:02 PDT 2007
On Fri, 24 Aug 2007 19:05:06 +0200, Simon Pieters <zcorpan at gmail.com>
> Do we want to do this for quirks mode only? IE7 does it for standards
> mode as well, but Opera, Firefox and Safari have different (stricter)
> processing rules for standards mode.
I'd suggest that we do the same thing for both quirks mode and standards
It seems IE also supports CSS2 System Colors.
The algorithm (once again; hopefully this time it'll stick):
1. If the string is the empty string, act as if the attribute was
absent and abort these steps.
2. If the string ASCII-case-insensitively matches a css3-color keyword
or one of the CSS2 System Colors, or is "transparent"
(ASCII-case-insensitively), use that and abort these steps.
3. Trim all but the first 128 chars from the string.
4. If it exists, strip the first leading #.
5. Replace non-valid-hex chars with 0s.
6. ASCII-lower-case the string.
7. Make string length a multiple of 3 and a minimum of 3 by appending
8. Split the string into 3 equal segments.
9. Trim all but the right-most 8 chars from each segment.
10. If segment length is 1, left-pad each segment with a 0, else:
11. While segment length is greater than 2 and the first char of each
segment is equal to 0, trim the left-most char from each segment,
12. Trim all but the first 2 chars from each segment.
13. Join the segments and append them to a # char to create the final
More information about the whatwg