8
8
[ ![ Backers] [ backers-badge ]] [ collective ]
9
9
[ ![ Chat] [ chat-badge ]] [ chat ]
10
10
11
- [ hast] [ ] utility with equivalents for ` querySelector ` , ` querySelectorAll ` ,
12
- and ` matches ` .
11
+ [ hast] [ ] utility with equivalents for ` matches ` , ` querySelector ` ,
12
+ and ` querySelectorAll ` .
13
13
14
14
## Contents
15
15
@@ -33,8 +33,8 @@ and `matches`.
33
33
34
34
## What is this?
35
35
36
- This package lets you find nodes in a tree, similar to how ` querySelector ` ,
37
- ` querySelectorAll ` , and ` matches ` work with the DOM.
36
+ This package lets you find nodes in a tree, similar to how ` matches ` ,
37
+ ` querySelector ` , and ` querySelectorAll ` work with the DOM.
38
38
39
39
One notable difference between DOM and hast is that DOM nodes have references
40
40
to their parents, meaning that ` document.body.matches(':last-child') ` can
@@ -56,7 +56,7 @@ find and match any unist node.
56
56
## Install
57
57
58
58
This package is [ ESM only] [ esm ] .
59
- In Node.js (version 14.14+ and 16.0 +), install with [ npm] [ ] :
59
+ In Node.js (version 16 +), install with [ npm] [ ] :
60
60
61
61
``` sh
62
62
npm install hast-util-select
@@ -103,8 +103,8 @@ console.log(selectAll('h1 ~ :nth-child(even)', tree))
103
103
104
104
## API
105
105
106
- This package exports the identifiers [ ` matches ` ] [ matches ] , [ ` select ` ] [ select ] ,
107
- and [ ` selectAll ` ] [ selectall ] .
106
+ This package exports the identifiers [ ` matches ` ] [ api- matches] ,
107
+ [ ` select ` ] [ api-select ] , and [ ` selectAll ` ] [ api-select-all ] .
108
108
There is no default export.
109
109
110
110
### ` matches(selector, node[, space]) `
@@ -122,7 +122,7 @@ This only checks that the given element matches the selector.
122
122
— CSS selector, such as (` h1 ` , ` a, b ` )
123
123
* ` node ` ([ ` Node ` ] [ node ] , optional)
124
124
— node that might match ` selector ` , should be an element
125
- * ` space ` ([ ` Space ` ] [ space ] , default: ` 'html' ` )
125
+ * ` space ` ([ ` Space ` ] [ api- space] , default: ` 'html' ` )
126
126
— name of namespace
127
127
128
128
###### Returns
@@ -155,7 +155,7 @@ Searches the tree in *[preorder][]*.
155
155
— CSS selector, such as (` h1 ` , ` a, b ` )
156
156
* ` tree ` ([ ` Node ` ] [ node ] , optional)
157
157
— tree to search
158
- * ` space ` ([ ` Space ` ] [ space ] , default: ` 'html' ` )
158
+ * ` space ` ([ ` Space ` ] [ api- space] , default: ` 'html' ` )
159
159
— name of namespace
160
160
161
161
###### Returns
@@ -203,7 +203,7 @@ Searches the tree in *[preorder][]*.
203
203
— CSS selector, such as (` h1 ` , ` a, b ` )
204
204
* ` tree ` ([ ` Node ` ] [ node ] , optional)
205
205
— tree to search
206
- * ` space ` ([ ` Space ` ] [ space ] , default: ` 'html' ` )
206
+ * ` space ` ([ ` Space ` ] [ api- space] , default: ` 'html' ` )
207
207
— name of namespace
208
208
209
209
###### Returns
@@ -276,8 +276,8 @@ type Space = 'html' | 'svg'
276
276
* [x] ` [attr *=value ]` (attribute contains)
277
277
* [x] ` : dir ()` (functional pseudo-class)
278
278
* [x] ` : has ()` (functional pseudo-class)
279
- * [x] ` : lang ()` (functional pseudo-class)
280
279
* [x] ` : is ()` (functional pseudo-class)
280
+ * [x] ` : lang ()` (functional pseudo-class)
281
281
* [x] ` : not ()` (functional pseudo-class)
282
282
* [x] ` : any -link ` (pseudo-class)
283
283
* [x] ` : blank ` (pseudo-class)
@@ -367,14 +367,17 @@ type Space = 'html' | 'svg'
367
367
## Types
368
368
369
369
This package is fully typed with [TypeScript][].
370
- It exports the additional type [ ` Space ` ][space].
370
+ It exports the additional type [ ` Space ` ][api- space].
371
371
372
372
## Compatibility
373
373
374
- Projects maintained by the unified collective are compatible with all maintained
374
+ Projects maintained by the unified collective are compatible with maintained
375
375
versions of Node.js.
376
- As of now, that is Node.js 14.14+ and 16.0+.
377
- Our projects sometimes work with older versions, but this is not guaranteed.
376
+
377
+ When we cut a new major release, we drop support for unmaintained versions of
378
+ Node.
379
+ This means we try to keep the current release line, ` hast -util -select @^5 ` ,
380
+ compatible with Node.js 12.
378
381
379
382
## Security
380
383
@@ -420,9 +423,9 @@ abide by its terms.
420
423
421
424
[downloads]: https://www.npmjs.com/package/hast-util-select
422
425
423
- [size-badge]: https://img.shields.io/bundlephobia/minzip/ hast-util-select.svg
426
+ [size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q= hast-util-select
424
427
425
- [size]: https://bundlephobia .com/result?p =hast-util-select
428
+ [size]: https://bundlejs .com/?q =hast-util-select
426
429
427
430
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
428
431
@@ -466,10 +469,10 @@ abide by its terms.
466
469
467
470
[unist-util-select]: https://github.com/syntax-tree/unist-util-select
468
471
469
- [matches]: #matchesselector-node-space
472
+ [api- matches]: #matchesselector-node-space
470
473
471
- [select]: #selectselector-tree-space
474
+ [api- select]: #selectselector-tree-space
472
475
473
- [selectall ]: #selectallselector-tree-space
476
+ [api-select-all ]: #selectallselector-tree-space
474
477
475
- [space]: #space
478
+ [api- space]: #space
0 commit comments