W3C home > Mailing lists > Public > www-style@w3.org > February 2010

[cssom] serializing <color>

From: Anne van Kesteren <annevk@opera.com>
Date: Mon, 15 Feb 2010 14:47:09 +0100
To: "CSS WG" <www-style@w3.org>
Message-ID: <op.u758kvnh64w2qv@annevk-t60>
Opera uses the algorithm specified for <canvas> everywhere. This means  
#rrggbb for when alpha is 1 and otherwise rgba().


Gecko uses different serialization algorithms. System colors and color  
keywords are preserved for e.g. the .style.color case but not for  
<canvas>. (The keywords are returned in lowercase, not in the case  
specified by the specification. I personally like this.) Also, instead of  
#rrggbb it uses rgb() for .style.color, though not for <canvas>.

Gecko also uses a slightly different parser for <canvas> it seems. E.g. I  
found it accepts "red garbage" and treats that the same as "red" whereas  
.style.color will not.


WebKit (I toyed with Chrome) seems to follow Gecko, though the <canvas>  
part was quite buggy (fillStyle accepts any string and just returns it?)  
and tests with system colors and .style.color failed.


I played in the "Live DOM Viewer" with these bits of code by the way:

<!DOCTYPE html>
...<script>
  var x =document.createElement("canvas").getContext("2d")
  x.fillStyle = "red garbage"
  w(x.fillStyle)
</script>


<!DOCTYPE html>
...<script>
  document.body.style.color = "#fff"
  w(document.body.style.color)
</script>


Any thoughts as to what direction we want this to go in?

Personally I quite prefer the way Opera handles this, though preserving  
system colors might be valuable. Not sure.


-- 
Anne van Kesteren
http://annevankesteren.nl/
Received on Monday, 15 February 2010 13:47:41 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:24 GMT