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

Re: Selector for parent/predecessor?

From: Allan Sandfeld Jensen <kde@carewolf.com>
Date: Mon, 21 Aug 2006 02:06:04 +0200
To: www-style@w3.org
Message-Id: <200608210206.04989.kde@carewolf.com>

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.

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

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