@@ -168,79 +168,129 @@ for an implementation backed by the DOM.
168
168
169
169
_ As defined by CSS 4 and / or jQuery._
170
170
171
- - [ Selector lists] ( https://developer.mozilla.org/en-US/docs/Web/CSS/Selector_list )
172
- (` , ` )
173
- - [ Universal] ( https://developer.mozilla.org/en-US/docs/Web/CSS/Universal_selectors )
174
- (` * ` )
175
171
- [ Type] ( https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors )
176
- (` <tagname> ` )
172
+ (` <tagname> ` ): Selects elements by their tag name.
177
173
- [ Descendant] ( https://developer.mozilla.org/en-US/docs/Web/CSS/Descendant_combinator )
178
- (` ` )
174
+ (` ` ): Selects elements that are descendants of the specified element.
179
175
- [ Child] ( https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator )
180
- (` > ` )
181
- - Parent (` < ` )
176
+ (` > ` ): Selects elements that are direct children of the specified element.
177
+ - Parent (` < ` ): Selects elements that are direct parents of the specified
178
+ element.
182
179
- [ Adjacent sibling] ( https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_combinator )
183
- (` + ` )
180
+ (` + ` ): Selects elements that are the next sibling of the specified element.
184
181
- [ General sibling] ( https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_combinator )
185
- (` ~ ` )
182
+ (` ~ ` ): Selects elements that are siblings of the specified element.
186
183
- [ Attribute] ( https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors )
187
184
(` [attr=foo] ` ), with supported comparisons:
188
- - ` [attr] ` (existential)
189
- - ` = `
190
- - ` ~= `
191
- - ` |= `
192
- - ` *= `
193
- - ` ^= `
194
- - ` $= `
195
- - ` != `
185
+ - ` [attr] ` (existential): Selects elements with the specified attribute,
186
+ whatever its value.
187
+ - ` = ` : Selects elements with the specified attribute and value.
188
+ - ` ~= ` : Selects elements with the specified attribute and value, separated
189
+ by spaces.
190
+ - ` |= ` : Selects elements with the specified attribute and value, separated
191
+ by hyphens.
192
+ - ` *= ` : Selects elements with the specified attribute and value, anywhere
193
+ in the attribute value.
194
+ - ` ^= ` : Selects elements with the specified attribute and value, beginning
195
+ at the beginning of the attribute value.
196
+ - ` $= ` : Selects elements with the specified attribute and value, ending at
197
+ the end of the attribute value.
198
+ - ` != ` : Selects elements with the specified attribute and value, not equal
199
+ to the specified value.
196
200
- ` i ` and ` s ` can be added after the comparison to make the comparison
197
201
case-insensitive or case-sensitive (eg. ` [attr=foo i] ` ). If neither is
198
202
supplied, css-select will follow the HTML spec's
199
203
[ case-sensitivity rules] ( https://html.spec.whatwg.org/multipage/semantics-other.html#case-sensitivity-of-selectors ) .
204
+ - [ Selector lists] ( https://developer.mozilla.org/en-US/docs/Web/CSS/Selector_list )
205
+ (` , ` ): Selects elements that match any of the specified selectors.
206
+ - [ Universal] ( https://developer.mozilla.org/en-US/docs/Web/CSS/Universal_selectors )
207
+ (` * ` ): Selects all elements.
200
208
- Pseudos:
201
- - [ ` :not ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:not )
202
- - [ ` :contains ` ] ( https://api.jquery.com/contains-selector )
203
- - ` :icontains ` (case-insensitive version of ` :contains ` )
204
- - [ ` :has ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:has )
205
- - [ ` :root ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:root )
206
- - [ ` :empty ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:empty )
207
- - [ ` :parent ` ] ( https://api.jquery.com/parent-selector )
208
- - [ ` :first-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:first-child ) ,
209
- [ ` :last-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:last-child ) ,
210
- [ ` :first-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:first-of-type ) ,
211
- [ ` :last-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:last-of-type )
212
- - [ ` :only-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:only-of-type ) ,
213
- [ ` :only-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child )
214
- - [ ` :nth-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child ) ,
215
- [ ` :nth-last-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-child ) ,
216
- [ ` :nth-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type ) ,
217
- [ ` :nth-last-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-of-type ) ,
218
- - [ ` :link ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:link ) ,
219
- [ ` :any-link ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:any-link )
209
+ - [ ` :not ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:not ) : Selects
210
+ elements that do not match the specified selector.
211
+ - [ ` :contains ` ] ( https://api.jquery.com/contains-selector ) : Selects
212
+ elements that contain the specified text.
213
+ - ` :icontains ` : Selects elements that contain the specified text,
214
+ case-insensitively.
215
+ - [ ` :has ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:has ) : Selects
216
+ elements that have descendants that match the specified selector.
217
+ - [ ` :root ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:root ) :
218
+ Selects the root element.
219
+ - [ ` :empty ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:empty ) :
220
+ Selects elements that have no children.
221
+ - [ ` :first-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:first-child ) :
222
+ Selects elements that are the first element child of their parent.
223
+ - [ ` :last-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:last-child ) :
224
+ Selects elements that are the last element child of their parent.
225
+ - [ ` :first-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:first-of-type ) :
226
+ Selects elements that are the first element of their type.
227
+ - [ ` :last-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:last-of-type ) :
228
+ Selects elements that are the last element of their type.
229
+ - [ ` :only-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:only-of-type ) :
230
+ Selects elements that are the only element of their type.
231
+ - [ ` :only-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child ) :
232
+ Selects elements that are the only element child of their parent.
233
+ - [ ` :nth-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child ) :
234
+ Selects elements that are the nth element child of their parent.
235
+ - [ ` :nth-last-child ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-child ) :
236
+ Selects elements that are the nth element child of their parent,
237
+ counting from the last child.
238
+ - [ ` :nth-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type ) :
239
+ Selects elements that are the nth element of their type.
240
+ - [ ` :nth-last-of-type ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-of-type ) :
241
+ Selects elements that are the nth element of their type, counting from
242
+ the last child.
243
+ - [ ` :any-link ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:any-link ) :
244
+ Selects elements that are links.
245
+ - [ ` :link ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:link ) :
246
+ Selects elements that are links and have not been visited.
220
247
- [ ` :visited ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:visited ) ,
221
248
[ ` :hover ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:hover ) ,
222
249
[ ` :active ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:active )
223
250
(these depend on optional ` Adapter ` methods, so these will only match
224
251
elements if implemented in ` Adapter ` )
225
- - [ ` :selected ` ] ( https://api.jquery.com/selected-selector ) ,
226
- [ ` :checked ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:checked )
227
- - [ ` :enabled ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:enabled ) ,
228
- [ ` :disabled ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:disabled )
229
- - [ ` :required ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:required ) ,
230
- [ ` :optional ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:optional )
231
- - [ ` :header ` ] ( https://api.jquery.com/header-selector ) ,
232
- [ ` :button ` ] ( https://api.jquery.com/button-selector ) ,
233
- [ ` :input ` ] ( https://api.jquery.com/input-selector ) ,
234
- [ ` :text ` ] ( https://api.jquery.com/text-selector ) ,
235
- [ ` :checkbox ` ] ( https://api.jquery.com/checkbox-selector ) ,
236
- [ ` :file ` ] ( https://api.jquery.com/file-selector ) ,
237
- [ ` :password ` ] ( https://api.jquery.com/password-selector ) ,
238
- [ ` :reset ` ] ( https://api.jquery.com/reset-selector ) ,
239
- [ ` :radio ` ] ( https://api.jquery.com/radio-selector ) etc.
240
- - [ ` :is ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:is ) , plus its
241
- legacy alias ` :matches `
242
- - [ ` :scope ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:scope )
243
- (uses the context from the passed options)
252
+ - [ ` :checked ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:checked ) :
253
+ Selects ` input ` elements that are checked, or ` option ` elements that are
254
+ selected.
255
+ - [ ` :disabled ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:disabled ) :
256
+ Selects input elements that are disabled.
257
+ - [ ` :enabled ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:enabled ) :
258
+ Selects input elements that are not disabled.
259
+ - [ ` :required ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:required ) :
260
+ Selects input elements that are required.
261
+ - [ ` :optional ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:optional ) :
262
+ Selects input elements that are not required.
263
+ - jQuery extensions:
264
+ - [ ` :parent ` ] ( https://api.jquery.com/parent-selector ) : Selects
265
+ elements that have at least one child.
266
+ - [ ` :header ` ] ( https://api.jquery.com/header-selector ) : Selects header
267
+ elements.
268
+ - [ ` :selected ` ] ( https://api.jquery.com/selected-selector ) : Selects
269
+ ` option ` elements that are selected.
270
+ - [ ` :button ` ] ( https://api.jquery.com/button-selector ) : Selects button
271
+ elements, and ` input ` elements of type ` button ` .
272
+ - [ ` :input ` ] ( https://api.jquery.com/input-selector ) : Selects ` input ` ,
273
+ ` textarea ` , ` select ` , and ` button ` elements.
274
+ - [ ` :text ` ] ( https://api.jquery.com/text-selector ) : Selects ` input `
275
+ elements of type ` text ` .
276
+ - [ ` :checkbox ` ] ( https://api.jquery.com/checkbox-selector ) : Selects
277
+ ` input ` elements of type ` checkbox ` .
278
+ - [ ` :file ` ] ( https://api.jquery.com/file-selector ) : Selects ` input `
279
+ elements of type ` file ` .
280
+ - [ ` :password ` ] ( https://api.jquery.com/password-selector ) : Selects
281
+ ` input ` elements of type ` password ` .
282
+ - [ ` :reset ` ] ( https://api.jquery.com/reset-selector ) : Selects ` input `
283
+ elements of type ` reset ` .
284
+ - [ ` :radio ` ] ( https://api.jquery.com/radio-selector ) : Selects ` input `
285
+ elements of type ` radio ` .
286
+ - [ ` :is ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:is ) , as well
287
+ as the aliases
288
+ [ ` :where ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:where ) , and
289
+ the legacy alias ` :matches ` : Selects elements that match any of the
290
+ given selectors.
291
+ - [ ` :scope ` ] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:scope ) :
292
+ Selects elements that are part of the scope of the current selector.
293
+ This uses the context from the passed options.
244
294
245
295
---
246
296
0 commit comments