Re: :matches pseudo-class

W. Leon Sutton, Jr. wrote:

> Anne van Kesteren wrote:
>>>What he wants is kind of a reference to other elements inside a
>>>selector.
> 
>>Such a proposal has been made. The syntax wasn't clear yet, but I
>>thought it looked like:
>>
>>   <foo><bar/></foo>
>>
>>   foo:matches(bar){
>>    background:lime
>>   }
> No, no, you're missing the point.  I'm looking for non-nested elements.
> <foo><bar /></foo> is a reference to parent and child nodes.
> 
> I'm looking for, more or less, something like:
> <foo>[content]</foo>
> <blah>[content]</blah>
> <bar />

For that simple example, the CSS3 Selectors can already do what you need:
foo~bar { ... }
will select any bar that follows a foo

But, from your original example in your initial post, which I've 
reformated for easier reading:
# <p>
#    <a class="hovered" href="#">Hover me!</a>
# </p>
# <p>This is just some filler text to lead by my example.
#    What will follow is another element (DIV) that should
#    respond to the <a class="hovered"> element when it's
#    hovered over.</p>
# <div class="responder">I should show and hide whenever the
#     <a class="hovered"> is hovered and non-hovered.
# </div>

This could be solved using the :matches pseudo class as suggested by using:

p:matches(a.hovered)~div.responder { ... }

-- 
Lachlan Hunt

http://www.lachy.id.au/
lachlan.hunt@lachy.id.au

Received on Saturday, 21 August 2004 14:38:59 UTC