W3C home > Mailing lists > Public > www-style@w3.org > April 2007

Re: Select a parrent node with s CSS selector?

From: James Craig <jcraig@apple.com>
Date: Tue, 24 Apr 2007 23:35:40 -0700
Message-Id: <D8FE6699-CEBF-4FDC-A121-0C15A43A3618@apple.com>
To: 3w-style <www-style@w3.org>

Yahia Chlyeh wrote:

>> div.content p.description a:link:ancestor(div.content  
>> p.description) /* more specific */
> Wouldn't that allow any selector to be specified there (between  
> parentheses), rather than an actual ancestor?

It would, and the selector should only be true if both cases are true:

1. The element is an ancestor of the first selected element,  
"div.content p.description a:link"
2. The element matches the :ancestor selector, "div.content  

> If so, the nomination :ancestor should be changed.
> This may be widely better:
>   element:nth-ancestor(#)

But that implies a known distance up the DOM tree or selector tree.  
The previous example allows for selectors at an arbitrary distance  
from the descendant. Perhaps both would be useful.

:ancestor( selector )
:nth-ancestor( numeric )

Received on Wednesday, 25 April 2007 14:47:28 UTC

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