W3C home > Mailing lists > Public > www-style@w3.org > February 2014

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 11 Feb 2014 13:15:51 -0800
Message-ID: <CAAWBYDBmqnaCmnaBWFYVve2pph2tnVvqmE140zhoiB4tyu8dOw@mail.gmail.com>
To: Marat Tanalin <mtanalin@yandex.ru>
Cc: www-style list <www-style@w3.org>
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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:19 UTC