Re: [CSS4 Selectors] :matches naming bikeshed

On 06/18/2011 06:58 PM, Brian Kardell wrote:
> I am not sure if others have commented on the choice of !,

Heh, others have. I don't feel strongly about it, but we need something
as a placeholder to bikeshed about. :) I personally prefer $, since it's
a bit bolder (for use as a standalone character) and the S-shape can
stand for "self" or "selector". If you think that's better I can change
the draft.

> I see, reading through the linked emails in the wiki how the idea
> itself originates.  The ! was really the big hiccup I think.
> So... To make sure I've got it....instead of:
> div:has(.foo).bar:has(.x)
> Would you write:
> !div:matches(! .foo).bar:matches(! .x)
> ?

You have several options:! .foo):matches(! .x)

!! .foo) .x

!! .x) .foo

The selector in question selects a <div> of class "bar" that has
at least one descendent of the "foo" class and at least one descendant
of the "x" class.

I imagine this kind of branching, is pretty hard to implement efficiently.
What's in the draft right now wouldn't allow you to do that; you can use
the equivalent of at most one :has() per selector.


Received on Sunday, 19 June 2011 16:24:38 UTC