Re: Previous-sibling combinator

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 UTC