Re: Selector for parent/predecessor?

On Monday 21 August 2006 01:10, David Hyatt wrote:
> A parent selector is also extremely difficult to implement,
> especially dynamic cases.
>
Not really. It would only take me a few hours to implement it in KHTML. A 40 
line recursive function could do it. The dynamic restyling framework I wrote 
to correctly track the current child to parent or uncle relationships can 
easily track cousin to cousin relationships as well.

Compared to inheriting ::first-letter or ::first-line styles (part of CSS 
2.1), a parent or later sibling selector is trivial.


The syntax and structure I've been considering is based a parentheses. Where a 
parenthesis selects left instead of right:

For instance:
(A > B) 

Selects any A element with a B child.

(A > B) + C

Selects any C element with a A direct sibling that has a B child.

The code needed to implement this is a simple variant of the current recursive 
selector matcher.

`Allan

Received on Monday, 21 August 2006 00:13:56 UTC