Re: Select a parrent node with s CSS selector?

On Wed, 2007-04-25 at 01:32 +0100, Daniel Beardsmore wrote:

> I'm curious thus to know precisely *why* a parent node selector is so important? 
> What would it solve that cannot be solved with existing CSS2 or CSS3 selectors?

Personally, I find myself often in need of parent selector. Mostly it
would help to avoid adding extra class/id attributes to existing markup.

Consider the case: 

You've coded thirty or more pages for a website, with, for example:

.....

<div>
	<h2>Lorem Ipsum</h2>
	<p>Lorem Ipsum</p>
        <ul class="photos">
            <li><img></li>
           ....
</div>

...
<div>
	<h2>Lorem Ipsum</h2>
	<p>Lorem Ipsum</p>
</div>

<div>
	<h2>Lorem Ipsum</h2>
	<p>Lorem Ipsum</p>
	<p>Lorem Ipsum</p>
        <ul class="photos">
            <li><img></li>
           ....
</div>

Now, two weeks later the client calls you and tells you that any
sections ( <div>s in the example ) that have photos ( <ul
class="photos"> in the example ) in them should have dotted border. 

With parent selector this would be one line of code: div < ul.photos
{ border: 1px dotted #000; }

Without the selector I would have to add class attributes to all of
those divs on all of the pages.

I may admit that these kind of changes made by the client happen to me
quite often. 

Thank you for your time.
-- 
               Regards, Zoffix Znet     

        ( http://zoffix.com ,   http://haslayout.net )

Received on Wednesday, 25 April 2007 12:52:44 UTC