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

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

From: Brian Kardell <bkardell@gmail.com>
Date: Tue, 11 Feb 2014 16:20:31 -0500
Message-ID: <CADC=+je0mB2qbUBu8fWkfBOCmqYZS0vdwTmUGQia1nf8Na60tw@mail.gmail.com>
To: Marat Tanalin <mtanalin@yandex.ru>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, www-style list <www-style@w3.org>
On Tue, Feb 11, 2014 at 4: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).
>
>
According to selectors L4 you can have multiple ! (bangs).
http://dev.w3.org/csswg/selectors4/#subject
See what it means there -- you can also pair ! with :matches to achieve
what you can with :has in theory.

To be clear, I am *strongly* for :has, but I want to make sure that people
have all of the information to cast a vote.



-- 
Brian Kardell :: @briankardell :: hitchjs.com
Received on Tuesday, 11 February 2014 21:21:00 UTC

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