[whatwg] Color attributes

On Fri, 17 Oct 2008 00:01:02 +0200, Andy Lyttle <whatwg at phroggy.com> wrote:

> "While the first item's length in segments is greater than 2 and the  
> first character in each item in segments is a U+0030 DIGIT ZERO  
> character, remove the first character from each item in segments."
>
> Does this mean, if the length of the first item in segments is greater  
> than 2 then loop through each item in segments, and if the first  
> character is 0 then remove it?
>
> Or does it mean, if the length of the first item in segments is greater  
> than 2 and the first character of every item in segments is 0, then loop  
> through each item and delete the first character, but if the first  
> character of any item is not 0 then leave the whole thing alone?
>
> I'm assuming you meant #1, but your wording isn't perfectly clear.

I meant #2. Reworded.


> Has it occurred to you that while your algorithm makes the string "foo"  
> return an error, the string "l33tsp34k" is converted to a dark purple?

Yes. I thought it matched webkit. But further testing shows that it does  
not. :-(

999 -> #000999
aaa -> #aaaaaa
aax -> #000000
#999 -> #999999
#aax -> #000000

I've made the algorithm return input if it's correct "#rgb" and otherwise  
continue the algorithm (which will instead match IE).

So the above would instead be:

999 -> #090909
aaa -> #0a0a0a
aax -> #0a0a00
#999 -> #999999
#aax -> #0a0a00


Thanks!

-- 
Simon Pieters
Opera Software

Received on Friday, 17 October 2008 01:58:27 UTC