Re: :parent and previous siblings selectors

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 UTC