W3C home > Mailing lists > Public > www-style@w3.org > October 2008

Re: [Css Variables] Variable Declaration Blocks

From: David Smith <catfish.man@gmail.com>
Date: Wed, 1 Oct 2008 16:14:01 -0700
Cc: Andrew Fedoniouk <news@terrainformatica.com>
Message-Id: <3D19D644-1EFB-48DF-9AAF-0EE9C047D960@gmail.com>
To: www-style@w3.org

I've been watching the CSS variables proposal with quite a bit of  
interest, since it would be extremely helpful for what I'm doing. I  
work on Adium (adiumx.com) a popular open source instant messaging  
program, which uses HTML/CSS/JS for displaying messages. Currently  
this works by having message style authors provide HTML templates with  
special keywords; when a message is sent or received, the template is  
copied, the keywords filled in with the current values, and the  
resulting html string is sent to WebKit using the Objective-C DOM  
interface (createContextualFragment specifically). You can see  
examples of message styles created by the community here: http://adiumxtras.com/index.php?a=search&cat_id=5

In a number of cases, the keywords in question refer to persistent  
attributes of a conversation such as the url of an icon representing  
the person you're talking to, or their name, rather than per-message  
attributes like the exact text sent. When these persistent attributes  
change, Adium has to traverse the whole DOM looking for places where  
they were used and updating to the new value, which is definitely less  
than ideal. CSS variables would make this completely trivial, as well  
as significantly faster. Instead of something like <div  
class="message"><img src="%%userIcon%%">%%displayName%%%%message%%</ 
div> we would have <div class="message %%senderID%%">%%message%%</div>  
and use content() and background-image with variables to insert the  
persistent name and icon. Updating when the name or icon changed would  
then be a simple matter of setting a new value via the CSSOM.

Tim Hatcher, the developer of http://colloquy.info/, has expressed  
interest as well for very similar reasons.

I realize this may be a bit out of scope for CSS's intended uses, but  
I think the use I've described would very likely have parallels in  
many web applications (gmail seems like an obvious one, given its  
similarities to a chat program).

								David Smith

On Oct 1, 2008, at 9:46 AM, Andrew Fedoniouk wrote:

>
> Why would people need "CSS variables" at all?
>
> We've got a lot of discussion around them but I am failing to
> see the forest behind those trees.
>
> Could anyone clearly explain why "CSS variables" there at all:
> 1) What problems they are trying to solve, etc.?
> 2) Why they are variables and not constants?
> 3) Are there any requests from community for exactly variables?
>
> Thanks in advance.
>
> -- 
> Andrew Fedoniouk.
>
> http://terrainformatica.com
>
Received on Thursday, 2 October 2008 02:08:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:13 GMT