- From: Mike Wilson <mikewse@hotmail.com>
- Date: Mon, 6 Oct 2008 17:58:52 +0200
- To: "'Anne van Kesteren'" <annevk@opera.com>
- Cc: <www-style@w3.org>
Anne van Kesteren wrote: > Style sheets on the Web are hardly ever modified through > the CSSOM so optimising for that does not seem like such > a good idea to me, I think it is safe to say that f ex adding and removing classes on an element is a much more common way of changing style than doing modifications through CSSOM, so we certainly agree there. But then I think one of the reasons that might hold devs off from using CSSOM for run-time style changes is the lack of an actual "reuse" construct in CSS - which incidentally is the construct we are discussing in this thread. Currently, say if a developer would like to use script to change the background color on a number of (different kinds of) elements. He will probably have to iterate over a number of rules in the style sheet, as CSS designs without reuse constructs (variables) usually choose to copy/paste color information into multiple rules. Even if he does the hard work of hard-coding this process it will risk to break on the next update when the CSS designer adds or changes a few rules. Personally I would avoid the whole thing and I think most do. But consider if there was a variable representing the background color for this set of / kind of elements, which was included/referenced by all applicable rules above. Then we would only need to CSSOM-update the variable to get what we want and not have to worry about rule changes. In this case the variable could be seen as a contract between the CSS designer and the page author. So I think we are in a sort of Catch 22 here; "style changes through CSSOM are not so useful anyway so we shouldn't add variables to it", and "CSSOM style changes would become much more useful if having variables". Fixing the latter voids the former and I think CSSOM would see much more use when exposing variables. Best regards Mike Wilson > -----Original Message----- > From: www-style-request@w3.org > [mailto:www-style-request@w3.org] On Behalf Of Anne van Kesteren > Sent: den 25 september 2008 10:10 > To: Mike Wilson > Cc: www-style@w3.org > Subject: Re: [Css Variables] Variable Declaration Blocks > > > On Thu, 25 Sep 2008 08:12:22 +0200, Mike Wilson > <mikewse@hotmail.com> > wrote: > > fantasai wrote: > >> This was as far as I got Friday afternoon at the F2F: > >> http://fantasai.inkedblade.net/style/specs/constants/ > >> > >> It's not very complete, but I think it captures the > important points > >> in the discussion. > > > > The discussion in the meeting notes > > http://lists.w3.org/Archives/Public/www-style/2008Sep/0075.html > > was kind of brief regarding some of the technical problems with the > > original CSS Vars suggestion. > > Well, the CSSOM problem is significant. > > > > I think Dave's implementation with > > changeable/scriptable variables is far more elegant than a parse- > > time solution where the constants are no longer visible > after parsing. > > Could you elaborate on why you consider it to be more elegant? Style > sheets on the Web are hardly ever modified through the CSSOM > so optimising > for that does not seem like such a good idea to me, given the added > complexity and changes we need to make to make it work properly. > > > (FWIW, Opera is fine with adding constants support as per > Elika's draft, > modulo quibbling about the name of @style. We're not really > interested in > adding (mutable) variables.) > > > -- > Anne van Kesteren > <http://annevankesteren.nl/> > <http://www.opera.com/> > >
Received on Monday, 6 October 2008 15:59:49 UTC