W3C home > Mailing lists > Public > www-style@w3.org > July 2011

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

From: Jens O. Meiert <jens@meiert.com>
Date: Thu, 21 Jul 2011 09:30:19 -0700
Message-ID: <CAJ0g8QSM2euv_xeSCnJ9ZjFBfBwqd4n_FRiznghzKKphjYXQnA@mail.gmail.com>
To: Alexander Shpack <shadowkin@gmail.com>
(bcc: www-style@)

> 98% of any HTML code generates by server side scripts, isn't?

Do you have data backing this number?

Even if that number is that high, there are no benefits, in fact only
problems, controlling presentation over HTML. Spending time on
refactoring class names like “b-menu_size_small” when your menu
changes appearance is more than unnecessary. For purposes of managing
presentation you want to only change your style sheet.

Then, don’t forget the price you’re paying for complexity:

<ul id=b-menu>
  <li class=current>
  <li>
  <li>
</ul>

would be way easier to understand and work with.

> This code is much faster than nested selectors like this
>
> UL.menu LI { /* style */ }

I guess you’re referring to work Steve Souders and others did on
selector performance? Then don’t forget the fact that the effects only
show if you’re talking about hundreds or sometimes thousands of
selectors.

Seen absolutely, yes, “.menu-item” is faster than “.menu li”. Seen
relatively you’re talking about microseconds in savings while
sacrificing, as indicated above, a) maintainability, b)
understandability, and are c) limiting yourself to one single
development approach.

Last but not least, don’t forget that specialists have the benefit of
focusing on just their area of expertise. Web developers don’t have
that benefit: they need to marry all the different topics that impact
their work, like HTML, CSS, scripting, accessibility, performance,
maintainability, HTTP, URLs, encodings, etc.pp. Finding a good balance
between all these topics is the challenge web developers face, and the
success in doing so makes for the difference between a web developer
and an expert web developer.

-- 
Jens O. Meiert
http://meiert.com/en/
Received on Thursday, 21 July 2011 16:31:09 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:42 GMT