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

> > 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
http://meiert.com/en/

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