W3C home > Mailing lists > Public > www-style@w3.org > September 2013

Re: [selectors4] Use pesudo-class instead for selecting parent elems

From: Brian Kardell <bkardell@gmail.com>
Date: Tue, 3 Sep 2013 11:28:16 -0400
Message-ID: <CADC=+jd08UA=Wb4=bfXc0PmZyn8pJG=oO6ZE0U4m9eJ1W38uFA@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Simon Sapin <simon.sapin@exyr.org>, Xidorn Quan <quanxunzhen@gmail.com>, www-style list <www-style@w3.org>
On Tue, Sep 3, 2013 at 11:15 AM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> On Tue, Sep 3, 2013 at 1:24 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
> > Le 03/09/2013 09:15, Simon Sapin a écrit :
> >> Le 03/09/2013 03:00, Xidorn Quan a écrit :
> >>> I believe that :matches which supports complete complex selector is
> >>> hard, if not impossible, to be implemented in a fast way, but it is
> >>> possible for the pseudo-class I requested which narrows the looking-up
> >>> range to its descendents.
> >>
> >> Is it? As far as I understand, the problem here is that a dynamic change
> >> anywhere in the tree, in the presence of such selectors, would require a
> >> big part of the tree or the whole document to be restyled.
> >>
> >> Does your proposal really help with that? Especially (see below) if the
> >> argument to :has() can start with a combinator.
>
> Boris has said before that a restricted form of :has() that only
> selected for children would likely be acceptable from a performance
> standpoint.
>
> > I should add: I’m not convinced that :has() solves any performance
> problem,
> > but if it turns out to be equivalent in expressive power to the subject
> > indicator, I like this proposed syntax better. (:has() has no equivalent
> to
> > multiple subject indicators in the same selector, but I’m not overly
> > attached to that feature.)
>
> It's equivalent, yes.  Depending on what you're doing, it may be more
> or less convenient to express a given selector.
>
> ~TJ
>
>

Readability is a big one for me - :has feels really natural... I don't know
anyone who doesn't look at it for a minute and doesn't have a pretty good
guess what it does.  ! is definitely teachable, I get it, and even the
rationale -- I don't want to over-emphasize, but it feel unnecessarily
reg-exy and obscure.  :has was part of the original proposals over a decade
ago, and I still think it is better.

Even if we wind up with ! and :matches - I don't honestly see a good reason
to not at least alias that pattern as :has or something for readability
sake...


-- 
Brian Kardell :: @briankardell :: hitchjs.com
Received on Tuesday, 3 September 2013 15:28:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:34 UTC