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

Re: Previous-sibling combinator

From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
Date: Sat, 28 Jan 2012 16:35:50 +0400
To: Eli Morris-Heft <eli.morris.heft@gmail.com>
Cc: www-style@w3.org,Tab Atkins Jr. <jackalmage@gmail.com>
Message-Id: <228201327754150@web25.yandex.ru>
28.01.2012, 04:09, "Eli Morris-Heft" <eli.morris.heft@gmail.com>:
> On Jan 27, 2012 5:46 PM, "Marat Tanalin | tanalin.com" <mtanalin@yandex.ru> wrote:
>>  P - UL > LI
>>  :matches(!UL + P) > LI
>
> Though it's a bit silly, it occurs to me to note that the previous-sibling selector isn't a cure-all. What if you want to refer to the ul in your example? You need something like:
>
> p - !ul > li
> or
> p + ul:has(> li)
>
> Damn. I used to be a fan of the ! indicator, but I think I just talked myself out of it...

Previous-sibling combinator is not cure-all -- as well as any individual selector or combinator is not too.

And your first example ('p - !ul > li') additionally demonstrates that previous-sibling combinator could _coexist_ in harmony with selectors of another types, and they are _not_ mutually exclusive.
Received on Saturday, 28 January 2012 12:36:30 GMT

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