Re: Selector Syntax Survey - subject indicator vs :has()

On Tue, Feb 11, 2014 at 1:14 PM, Marat Tanalin <mtanalin@yandex.ru> wrote:
> 12.02.2014, 00:55, "Tab Atkins Jr." <jackalmage@gmail.com>:
>> I've just posted the selector syntax survey I was charged with at the
>> last f2f: https://docs.google.com/forms/d/1x0eXPBj1GN8Zau-7k9J_JGhoM6uGEqlJBkBBDFswT2w/viewform
>>
>> This will help us decide whether to use the subject indicator or the
>> :has() pseudoclass.  Please answer and share this poll!
>
> Looks like a false dichotomy. As far as I understand, the subject selector is not capable of all things that `:has()` is capable of.
>
> If to choose anyway, then, of course, `:has()` is preferred since it allows (at least potentially) to do more complex and useful things like using multiple `:has()` (including nested ones) in the same selector:
>
>     .example:has(nav a:has(> img) + div:has(span))
>
> So we can have multiple `:has()` subselectors while we cannot have multiple subject selectors (and even if we did, that most likely would not be as readable / intuitive / straightforward as `:has()` is).

Using :matches(), the subject indicator is exactly identical in power to :has().

~TJ

Received on Tuesday, 11 February 2014 21:16:39 UTC