Re: [selectors] Previous-sibling combinator

I agree. It would be a good idea to add something explicit.

Developers can do ugly things to get to the siblings:
     #target:nth-last-child(2 of #target, #target ~ foo + bar)
(e.g. on WebKit Nightly: http://codepen.io/anon/pen/GgvMqP)

Benjamin

On 1/28/15 4:34 PM, Marat Tanalin wrote:
> We should probably reconsider adding the previous-sibling combinator [1] to CSS since:
>
>      * the subject indicator is dropped [2];
>
>      * the `:has()` function will not be available in fast profile (and therefore in CSS) [3].
>
> Thanks.
>
> [1] https://lists.w3.org/Archives/Public/www-style/2012Jan/1245.html
> [2] https://lists.w3.org/Archives/Public/www-style/2014Feb/0617.html
> [3] http://dev.w3.org/csswg/selectors/#fast-profile
>
>
>
> 28.01.2012, 03:34, "Tab Atkins Jr." <jackalmage@gmail.com>:
>> 2012/1/27 Marat Tanalin <mtanalin@yandex.ru>:
>>>   And how would you write following selector using subject indicator?
>>>
>>>      P - UL > LI {...}
>>
>> Using the future extension to :matches() to allow complex selectors:
>>
>> :matches(!ul + p) > li {...}
>>
>> Or, if I get my way, with :has():
>>
>> ul:has(+p) > li {...}
>

Received on Thursday, 29 January 2015 01:08:13 UTC