[whatwg] New method for obtaining a CSS property

Ian Hickson ian at hixie.ch
Mon May 9 14:35:59 PDT 2011


On Thu, 27 Jan 2011, Brett Zamir wrote:
> 
> For example, we want the designer guy to be able to freely change the 
> colors in the stylesheet for indicating say a successful transition 
> (green), an error (red), or waiting (yellow) for an Ajax request. The 
> JavaScript girl does not want to have to change her code every time the 
> designer has a new whim about making the error color a darker or lighter 
> red, and the designer is afraid of getting balled out for altering her 
> code improperly.

It seems there are several solutions to this problem:

 * Server-side preprocessing. Have some sort of file defining macros that 
   are then used by both the CSS and the JS during deployment. This will 
   work today.

 * Inspecting the results of the CSS cascade on specific elements, and 
   then reusing those colours in the JS. This will work today.

 * CSS variables and a CSS variables API. This is the declarative solution 
   to the problem. Not yet fully baked, but being worked on.

Since there are already several solutions here, I haven't added anything 
to the spec to handle this use case.

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list