- From: Tantek Çelik <tantek@cs.stanford.edu>
- Date: Sat, 1 Oct 2011 02:05:52 +0000
- To: "Brian Kardell" <bkardell@gmail.com>,"Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: "www-style@w3.org" <www-style@w3.org>,"Daniel Glazman" <daniel.glazman@disruptive-innovations.com>
- Message-ID: <1692319878-1317434754-cardhu_decombobulator_blackberry.rim.net-628381474-@b27.c>
Brian and Tab's case for :has() makes sense to me and I really like the way the example selectors read, much more readable than $ or ! options (or any other potential use of punctuation alone, frankly). I just read the jQuery documentation: http://api.jquery.com/has-selector/ and am convinced. Let's go with :has(). Thanks, Tantek -----Original Message----- From: Brian Kardell <bkardell@gmail.com> Sender: www-style-request@w3.org Date: Fri, 30 Sep 2011 20:22:16 To: Tab Atkins Jr.<jackalmage@gmail.com> Cc: www-style@w3.org<www-style@w3.org>; Daniel Glazman<daniel.glazman@disruptive-innovations.com> Subject: Re: Selectors 4 and Variables I believe you are thinking of the multiple discussions where people (you, me, Hixie, others?) have made this case to no avail. To recap: I believe fantasi's concern was that combinators are problematic without extra syntax like: doc:has($ > .foo) Unless you go jquery route (which I like) and scope it so that the lhs of the combinator can be left off (because it is pretty unambiguous). As Hixie and I have both pointed out, has actually has several benefits: 1. Can occur multiple times as in div:has(.foo)+div:has(.bar) 2. Ask a designer to read the two versions... Has is intuitive. 3. It is essentially asking to codify something already popular and proven... How often do you get a win like that? On Sep 30, 2011 8:05 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote: > On Thu, Sep 29, 2011 at 11:35 PM, Daniel Glazman > <daniel.glazman@disruptive-innovations.com> wrote: >> Hi there, >> >> Both Selectors 4 and Variables now use the $ to represent something. >> I think this is wrong and will lead to CSS maintainance issues >> for web authors since a textual search for $p inside a style sheet will >> retrieve not only the definitions/calls to variable p but also the >> selectors having for subject a p. If this case will be probably be rare >> - but real - in the html world, it could be bigger in the xml one. >> I don't want to see that happen. >> >> I really have the gut feeling we should use different char descriptors >> here. Long, really long ago, I proposed to use !. I still think this is >> the best option, something very visual meaning an emphasis on the >> corresponding simple selector. > > 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. > > 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 {...} > > This also has the nice benefit of not using up the $ (or any other > glyph) inside of selectors. > > ~TJ >
Received on Saturday, 1 October 2011 02:06:26 UTC