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

Re: Selector for parent/predecessor?

From: David Hyatt <hyatt@apple.com>
Date: Tue, 22 Aug 2006 13:15:48 -0700
Message-Id: <C2BDD51E-B6B0-4E81-9691-55341A78BAB5@apple.com>
Cc: www-style@w3.org
To: Allan Sandfeld Jensen <kde@carewolf.com>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:46 GMT