[CSS4 Selectors] :has() (was Re: [CSSWG] ... F2F Kyoto]

On 11/06/2011 10:38 PM, Brian Kardell wrote:
> I have read through the wiki and the discussions surrounding
> subject/matches/has and I can't seem to find where ! is introduced.  In any
> case, I ran this privately past 5 designers and 2 programmers who are very
> good with CSS and without fail all eight of us had the same reaction as
> Opera voiced "that means not".  There was also unanimous agreement that
> has() as presented by Ian and implemented in jQuery for some time (with the
> addition of supporting rhs combinator), despite a smattering of limitations
> is both infinitely more intuitive/readable and fulfills the vast majority of
> their real world needs.
>
> It is also easy to implement and has the advantage that it already has shown
> its practical worth and is used by a large community.
>
> As I said, I read fantasai's comments on this, and I understand the
> objections on a larger "matches", but :has() seems like low hanging fruit
> that accomplishes a lot even if it could also be written with a matches() or
> some symbol notation.  Even if the later has much expressive power, I would
> personally willingly trade a certain amount of whatever that is for simple
> intuitiveness and readability.


So that I am clear in what :has() does. If I wanted to style any 
list-item <li> that does not have anchor links <a>, could use this selector?

ul:has(a) li { ... }


Could either of these work?

ul:has(a) { ... }

ul:has(li > a) { ... }

ul:has(a:hover) { ... }


CSS has never worked like that before.



-- 
Alan Gresley
http://css-3d.org/
http://css-class.com/

Received on Saturday, 11 June 2011 13:37:37 UTC