W3C home > Mailing lists > Public > www-style@w3.org > August 2004

Re: :matches pseudo-class

From: Lachlan Hunt <lachlan.hunt@iinet.net.au>
Date: Sun, 22 Aug 2004 00:38:51 +1000
Message-ID: <41275E7B.5070702@iinet.net.au>
To: "W. Leon Sutton, Jr." <wsuttonjr@hyponiqs.com>
CC: Anne van Kesteren <fora@annevankesteren.nl>, www-style@w3.org

W. Leon Sutton, Jr. wrote:

> Anne van Kesteren wrote:
>>>What he wants is kind of a reference to other elements inside a
>>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

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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:15 UTC