Re: Selector for parent/predecessor?

It's not difficult to implement simple cases, but creating an  
implementation that can re-resolve efficiently when the selector is  
chained with descendant or sibling selectors is pretty difficult.

dave

On Aug 20, 2006, at 5:06 PM, Allan Sandfeld Jensen wrote:

>
> 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 Tuesday, 22 August 2006 20:16:12 UTC