- From: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
- Date: Thu, 09 Oct 2008 10:10:01 +0200
- 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 others: additions --------- :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 :input, :text, :password, :radio, :checkbox, :submit, :image, :reset, :button :file match elements of the given type missing ------- :nth-last-child() :nth-of-type() :nth-last-of-type() :first-of-type :last-of-type :only-of-type :link :visited :active :hover :focus :target :lang() :root A few observations: - :even is redundant with :nth-child(even) - :odd is redundant with :nth-child(odd) - :gt(n) and :lt(n) are redundant with combinations of :not() and :nth-child() but are far easier to manage if n is high - :header is just a html-centric convenience for a group of selectors - :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 - :contains() was included in the old CSS 3 Selectors draft - :has() is an old request of the community - :parent is redundant with :not(:empty) - :hidden and :visible can also be dependant on the computed value of CSS properties (BTW, display and/or visibility ?) - the last additions are just shortcuts for lightly more complex selectors Of course, pseudo-elements are not here, but there's a :selected pseudo-class. 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 </Daniel> -- W3C CSS WG, Co-Chair
Received on Thursday, 9 October 2008 08:10:39 UTC