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

Re: [css3] Suggestion: Selector variables or “synonyms”

From: Jens Meiert <jens.meiert@erde3.com>
Date: Wed, 06 Feb 2008 18:34:23 +0100
Cc: www-style@w3.org
Message-ID: <20080206173423.81730@gmx.net>
To: "Anne van Kesteren" <annevk@opera.com>

> > Isn't ".old = .new" just a convenient alternative
> > to ".old, .new {}" ?
> Is it?

It is.

Taking more complex examples would certainly mean a better explanation. I'll try with another though more or less abstract (and too short) one:

  address {}
  address, #sidebar blockquote p {}
  #sidebar ul {}
  #sidebar blockquote {}
  #sidebar blockquote p {}
  #new {}
  #new p {}
  #new p, #new span {}

… would mean the same as:

  #old = #new; /* just to make sure some partners can still use “#old” */
  @sb = #sidebar blockquote;
  @addr = address;

  @addr {}
  @addr, @sb p {}
  #sidebar ul {}
  @sb {}
  #sidebar blockquote p {} /* should be “@sb p” but would still work */
  #new {}
  #new p {}
  #new p, #new span {}

While the example doesn't illustrate the possible elegance and efficiency selector variables could mean yet, it hopefully does show a few things, for example the short notation for the contextual selector “#sidebar blockquote” or the shorter but still understandable “@addr” “placeholder”. It should also show the advantage of changing ID/class names while still allowing for “compatibility” concerning former names.

(Syntax still based on my suggestion, there might be more appropriate ways than using “=” signs or ”@” delimiters.)

Jens Meiert
Received on Wednesday, 6 February 2008 17:34:39 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:33 UTC