Re: Selectors in jQuery

John Resig wrote:
> 
> :not(a#id) - Complex selectors in :not().
> 
> :not(div > p) - Full selectors in :not().
> 
> :not(div, p, a) - Multiple selectors in :not(). In all of these cases they could be treated as a simple set operation. Take the current set of match elements, find the set of elements located within the :not(...) expression, and subtract the two from each other.
> 
> I don't remember if it's made explicitly clear in the CSS spec but we allow :not(:nth-child(2)) (parentheses within parentheses).
> 
> Right now we're looking at making two additions to the selector engine:
> 
>   div > (a, p)
> 
> Allowing for grouping of queries together (the above would be equivalent to: div > a, div > p). It's possible that this might have another syntax, for example :and() as a complement to :not().
> 
>   div > :not(a, p)
>   div > :and(a, p)

This functionality was proposed a long time ago as :matches(),
where :matches() takes a selector and is true if the element
matches that selector.

~fantasai

Received on Thursday, 9 October 2008 18:52:31 UTC