W3C home > Mailing lists > Public > www-style@w3.org > January 2010

Re: proposal for a new css combinator

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 14 Jan 2010 09:35:45 -0600
Message-ID: <dd0fbad1001140735r741240bboe2e3f1b654166342@mail.gmail.com>
To: Øyvind Stenhaug <oyvinds@opera.com>
Cc: Alan Gresley <alan@css-class.com>, www-style list <www-style@w3.org>
On Thu, Jan 14, 2010 at 9:24 AM, Øyvind Stenhaug <oyvinds@opera.com> wrote:
> On Thu, 14 Jan 2010 14:51:16 +0100, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>> On Thu, Jan 14, 2010 at 6:41 AM, Alan Gresley <alan@css-class.com> wrote:
> (...)
>>> .focusBlock header:first-descendant {
>>> // style rules //
>>> }
>>> In theory you could also have last-descendant.
>>> .focusBlock header:last-descendant {
>>> // style rules //
>>> }
>> :last-descendant would actually be marginally easier to implement, if
>> I'm thinking correctly, and plenty useful on its own (for many of the
>> same reasons that jQuery's closest() method is so useful).
> I'm not very familiar with typical implementation details, but I would've
> thought it were the other way around. When checking for a first descendant
> one would just need to walk up the tree, aborting if a header is found and
> giving a match if a .focusBlock is found. When checking for a last
> descendant it seems one would need to check the entire sub-tree of the
> header.

Oh, you're right.  You would have to verify the descendants of header
as well.  If you already know you're on a leaf, then it's really easy,

> Anyway, syntax-wise a combinator seems more natural than a pseudo-class. I
> can't think of any other pseudo-class where determining a match depends on
> what simple selectors there are earlier in the sequence.

You're right; I knew there was something niggling in the back of my
brain about it.  Combinators are indeed the way we indicate
relationships between different parts of the selector; pseudoclasses
and the like can only tell us special things about the document
itself, not the selector.  It would be best to maintain that

Received on Thursday, 14 January 2010 15:36:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:42 UTC