W3C home > Mailing lists > Public > www-style@w3.org > July 2014

Re: [css-color] Exposing browser color parsing to JS

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 07 Jul 2014 21:28:32 -0400
Message-ID: <53BB4940.3010802@mit.edu>
To: www-style@w3.org
On 7/7/14, 8:48 PM, Simon Sapin wrote:
> A trick I’ve seen in stuff made by Lea Verou to use the browser’s color
> parsing code is to set e.g. someElement.style.color to the string to
> parse, then get getComputedStyle(someElement).color, which is in rgb()
> or rgba() format and much easier to hand-parse.

While this is doable, it has a few drawbacks:

1)  It's slower than a custom API for parsing colors.
2)  It can't be done in workers, whereas exposing color parsing in
     particular may not be too super-terrible in workers.

-Boris
Received on Tuesday, 8 July 2014 01:29:00 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:23 UTC