- From: Brian Kardell <bkardell@gmail.com>
- Date: Sat, 1 Oct 2011 10:15:13 -0400
- To: François REMY <fremycompany_pub@yahoo.fr>
- Cc: www-style@w3.org, fantasai <fantasai.lists@inkedblade.net>
- Message-ID: <CADC=+jfj9yH5ffYtZ0N2e8kdC760rhGg-+_C2JJSpcbw7Vg1Fg@mail.gmail.com>
Is it just me or does this seem highly related to the :scope / :matches / @global discussion a few days (maybe a week) back? On Oct 1, 2011 4:09 AM, "François REMY" <fremycompany_pub@yahoo.fr> wrote: > We can use the :has pseudo class and restricts his usage to achieve the same > thing. Those allowed usages can then be extended over time, in function of > what implementers are ready to do. > > It seems clear to me that the goal of the "$" notation was to force the > ":has" to be at the last position of the selector. This allows to restrict > the needed changes in the rule-matching algorithm to : "Allow a selector > matching an element to have effect on his ancestrors". This mean the only > restriction added to the system is that we should start to match CSS rules > to the deepest point of the DOM Tree and go backward, which most UA probably > do by now. If we allow :has everywhere, this assumption fails to be proven > and we may need a more complex tooling to find matched elements for those > rules, probably iterating two or more times the rule-matching algorithm each > time a new "parent match" is found. > > It may seems reasonable to restrict the :has pseudo-class to the last > position of the selector. It achieves the same effect and it's easy to add > more possibilities in the future without changing the syntax. > > (Or maybe am I missing the point?) > > > -----Message d'origine----- > From: fantasai > Sent: Saturday, October 01, 2011 5:15 AM > To: www-style@w3.org > Subject: Re: Selectors 4 and Variables > > On 09/30/2011 05:03 PM, Tab Atkins Jr. wrote: >> >> I thought it was generally agreed long ago that the best approach was >> to use :has() rather than a marker in the selector. It's more general >> and allows more types of things to be expressed. > > It wasn't *generally* agreed. It was only agreed by some people. > >> Basically, the subject indicator is exactly equivalent to a :has() >> pseudo limited to the end of the selector: >> >> foo $bar baz {...} == foo bar:has(baz) {...} >> >> However, :has() can be placed anywhere in the selector, and so allows >> more powerful selections: >> >> label:has(:checked) + section> p {...} > > The limitation to a single branch here is intentional, due to > implementation concerns. > > If I were going to do branching, I'd expand :matches() to take full > selectors rather than only compounds. > > label:matches(!#$%? :checked) + section > p { ... } > > This has the advantage that selectors work the same whether they > are within or without the pseudo-class argument. There's neither > implicit nor dangling combinators, as you have with :has(). > > ~fantasai > >
Received on Saturday, 1 October 2011 14:15:40 UTC