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

Re: proposal for a new css combinator

From: Řyvind Stenhaug <oyvinds@opera.com>
Date: Thu, 14 Jan 2010 16:24:35 +0100
To: "Tab Atkins Jr." <jackalmage@gmail.com>, "Alan Gresley" <alan@css-class.com>
Cc: "www-style list" <www-style@w3.org>
Message-ID: <op.u6i3q9faru61ud@oyvinds-desktop>
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.

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.

-- 
Řyvind Stenhaug
Core Norway, Opera Software ASA
Received on Thursday, 14 January 2010 15:25:17 GMT

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