Re: Select a parrent node with s CSS selector?

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  
p.description"

> 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 )

James

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