

Selectors in jQuery

From: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Date: Thu, 09 Oct 2008 10:10:01 +0200
Message-ID: <48EDBC59.9090609@disruptive-innovations.com>
To: "www-style@w3.org" <www-style@w3.org>, jresig@mozilla.com

I took a quick look at the list of selectors allowed by jQuery [1].
Mostly based on CSS 3 Selectors, it lacks a few of them while adding

:even           even elements, zero-indexed
:odd            odd elements, zero-indexed
:gt(n)          elements w/ index greater than n
:lt(n)          elements w/ index lower than n
:header         matches h1 to h6
:animated       elements that are currently animated
:contains(text) elements that contains the given text
:has(selector)  matches elements that contain at least one
                   element matching selector
:parent         matches elements that are parents
:hidden         elements that are hidden
:visible        elements that are visible
:file           match elements of the given type


A few observations:

- :animated is a weird thing since it relies on currenly executed
   scripts or CSS transitions, making a rule dependant on the computed
   value of a property
- :has() is an old request of the community
- :parent is redundant with :not(:empty)
- the last additions are just shortcuts for lightly more complex


John, is there a way we could make jQuery's list of accepted selectors
converge with CSS 3 Selectors ? Does the Selectors API help here ?

[1] http://docs.jquery.com/Selectors

W3C CSS WG, Co-Chair
Received on Thursday, 9 October 2008 08:10:39 GMT
