W3C home > Mailing lists > Public > www-style@w3.org > June 2009

Re: :parent and previous siblings selectors

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 29 Jun 2009 07:53:34 -0500
Message-ID: <dd0fbad0906290553v2fc4f3dbm7eea26263d3e53d8@mail.gmail.com>
To: Shira Gutgold <gutgold@yahoo.com>
Cc: www-style@w3.org
On Fri, Jun 26, 2009 at 2:58 AM, Shira Gutgold<gutgold@yahoo.com> wrote:
> Hello all,
> I've been trying to ascertain whether the :parent selector and previous
> siblings selector will be included in CSS3.
> Reading the mailing list correspondence, I got the impression that the
> :parent selector will be implemented but that the implementation of a
> previous siblings selector would be too costly and therefore probably
> abandoned.
> So first of all, could someone please confirm whether my impression is
> indeed correct?

I can't absolutely confirm, as I'm not an implementer, but yeah, that
was the impression I got from Boris.  Parent selector wouldn't be
*too* bad performance wise, and *maybe* previous adjacent sibling, but
ancestor and previous sibling are right out at the moment.

> Assuming the :parent selector will be implemented, I suppose a possible
> workaround for targeting previous siblings would be
> to style all the children of that parent like so:
> a.classname :parent a{
> }
> and then remove the style for the following selectors like so:
> a.classname ~ a{
> }

Except for the fact that the selector can't work quite like that
(you're targeting a descendant of a.classname which is a parent of
a.classname), yeah, that'd be perfect.  It's just like the workaround
you have to do to simulate :first-child.

The actual parent selector would be something like:

:parent(a.classname) a

Though in this case it seems more appropriate to call it :child() or
:has-child(), as the general pattern of functional pseudoclasses is to
name them after what they're selecting off of.

~TJ
Received on Monday, 29 June 2009 12:54:39 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:19 GMT