- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 2 Oct 2012 14:08:36 -0700
- To: Sylvain Galineau <sylvaing@microsoft.com>
- Cc: Glenn Adams <glenn@skynav.com>, W3C Style <www-style@w3.org>
On Tue, Oct 2, 2012 at 1:18 PM, Sylvain Galineau <sylvaing@microsoft.com> wrote: > [Tab Atkins Jr.:] >> I know from experience that, if you're using jQuery to get color values, >> and you want your website to work on IE, you have to be able to parse >> *all* of the variants - rgb/a(), hsl/a(), 3 and 6 digit hex, and named >> colors. I had to add several of those parsing modes to an old project. :/ >> >> Because of this, I suspect that most working parsers can handle quite a >> bit, so we can choose what representation we'd like. I'm less confident >> about their ability to handle the presence/absence of spaces between >> components. > > Depending on what format you use to specify your colors and how many versions > you're trying to cover then yes, it may go that far. Especially if you're > writing a library for the masses. > > But I'd be less concerned about code as popular and well-tested as jQuery's > than the code written or copy/pasted by less advanced authors who rolled > around their own web site or intranet app and assume rgb() because > computed opaque color values is all they ever manipulate. Then we switch them > to rgba(x,y,z,1) and things stop working. There is no shortage of code on > the web that was worked on until the point where 'it just worked' and no > further. jQuery, as far as I know, doesn't do any parsing for you - it just returns the computed value. That means that less advanced authors that just used getComputedStyle() are in the same boat - if they're shipping code to the masses that is supposed to work on IE, their parser has to be able to recognize everything. Of course, if they're just working on their own site, they only have to worry about the styles they actually used. In any case, it makes the most sense to follow one of the stricter browsers here that always converts into a particular format. > Spaces are another one. > > On the other hand IE9 re-worked serialization to align with what Anne had > written in the CSSOM ED and the impact was surprisingly muted. There may be > less parsing than we think; or, possibly, quality libs have taken over a > large portion of it. That's excellent! ~TJ
Received on Tuesday, 2 October 2012 21:09:24 UTC