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

Re: [css3-selectors] No way to select preceding sibling element

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Mon, 13 Jul 2009 20:38:26 -0400
Message-ID: <7c2a12e20907131738o3472ec91h9fe1fcc5b8e1981d@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Paul <paul@scriptfusion.com>, www-style@w3.org
On Mon, Jul 13, 2009 at 7:59 PM, Tab Atkins Jr.<jackalmage@gmail.com> wrote:
> As an addendum to my previous email, I'll note that we have some
> selectors in CSS that are just as bad as some of the reverse
> combinators.  :last-of-type, for example, is essentially equivalent to
> a reverse ~ ("p:last-of-type" and "p [reverse~] p" are identical in
> effect).

No, they aren't, AFAICT.  In <div><p>a<p>b<p>c</div>, p:last-of-type
matches only the final p, while p ~~ p (using ~~ for [reverse~] for
readability) matches the first two.  p:last-of-type is the same as
p:not(p ~~ p).

In principle :last-of-type (and :only-child, etc.) could require that
the whole page's style be recomputed.  E.g., you could have

<div>...whole page...</div>
<div>Minor footer nobody cares about</div>

and body > :only-child, or body > :last-of-type, or whatever.  But
they're narrower and so likely to be used less, I guess.  Plus they're
essential for some styling.
Received on Tuesday, 14 July 2009 00:39:02 UTC

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