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

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

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Wed, 20 Jul 2011 17:49:58 +0200
Message-ID: <6C0E5907B91E430F93E7CC20947E8094@FREMYD2>
To: "Alexander Shpack" <shadowkin@gmail.com>, "Jens O. Meiert" <jens@meiert.com>
Cc: <www-style@w3.org>
The ">" selector cover this special need, as far as I underdstand your 
problem.

Regards,
François

-----Message d'origine----- 
From: Alexander Shpack
Sent: Wednesday, July 20, 2011 9:11 AM
To: Jens O. Meiert
Cc: www-style@w3.org
Subject: Re: [css3] Suggestion: Selector variables or “synonyms”

> Out of curiosity, this code is inefficient and unmaintainable. Why
> should it be used to conclude anything around CSS?

98% of any HTML code generates by server side scripts, isn't?
This code is much faster than nested selectors like this

UL.menu LI { /* style */ }

BEM doesn't have any troubles with nested styles. In large projects
(not homepages, web-business-cards, little websites), this technique
make web-development cheaper.

Imagine, that you need to create two boxes: toolbox and  context menu

<ul class="toolbox">
<li>Tool 1</li>
<li>Tool 2</li>
<li>Tool 3</li>
</ul>

<ul class="contextMenu">
<li>Menu item 1</li>
<li>Menu item 2</li>
</ul>

Usual CSS code

.toolbox li { /* */ }
.contextMenu li { /* */ }

But, one time you will need to integrate context menu into toolbox.

<ul class="toolbox">
<li>Tool 1
   <ul class="contextMenu">
     <li>Menu item 1</li>
     <li>Menu item 2</li>
   </ul>
</li>
<li>Tool 2</li>
<li>Tool 3</li>
</ul>

But, it's not all, lets inverse this task, and put toolbox inside
context menu. And both cases should work fine.
So, happy coding! You will write tonnes of overlapping code.

-- 
s0rr0w 
Received on Wednesday, 20 July 2011 15:50:22 GMT

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