@@ -21,6 +21,7 @@ and `matches`.
21
21
* [ ` matches(selector, node[, space]) ` ] ( #matchesselector-node-space )
22
22
* [ ` select(selector, tree[, space]) ` ] ( #selectselector-tree-space )
23
23
* [ ` selectAll(selector, tree[, space]) ` ] ( #selectallselector-tree-space )
24
+ * [ ` Space ` ] ( #space )
24
25
* [ Support] ( #support )
25
26
* [ Unsupported] ( #unsupported )
26
27
* [ Types] ( #types )
@@ -55,7 +56,7 @@ find and match any unist node.
55
56
## Install
56
57
57
58
This package is [ ESM only] [ esm ] .
58
- In Node.js (version 14.14+, 16.0+), install with [ npm] [ ] :
59
+ In Node.js (version 14.14+ and 16.0+), install with [ npm] [ ] :
59
60
60
61
``` sh
61
62
npm install hast-util-select
@@ -102,7 +103,8 @@ console.log(selectAll('h1 ~ :nth-child(even)', tree))
102
103
103
104
## API
104
105
105
- This package exports the identifiers ` matches ` , ` select ` , and ` selectAll ` .
106
+ This package exports the identifiers [ ` matches ` ] [ matches ] , [ ` select ` ] [ select ] ,
107
+ and [ ` selectAll ` ] [ selectall ] .
106
108
There is no default export.
107
109
108
110
### ` matches(selector, node[, space]) `
@@ -120,7 +122,7 @@ This only checks that the given element matches the selector.
120
122
— CSS selector, such as (` h1 ` , ` a, b ` )
121
123
* ` node ` ([ ` Node ` ] [ node ] , optional)
122
124
— node that might match ` selector ` , should be an element
123
- * ` space ` (` 'svg' ` or ` 'html' ` , default: ` 'html' ` )
125
+ * ` space ` ([ ` Space ` ] [ space ] , default: ` 'html' ` )
124
126
— name of namespace
125
127
126
128
###### Returns
@@ -153,7 +155,7 @@ Searches the tree in *[preorder][]*.
153
155
— CSS selector, such as (` h1 ` , ` a, b ` )
154
156
* ` tree ` ([ ` Node ` ] [ node ] , optional)
155
157
— tree to search
156
- * ` space ` (` 'svg' ` or ` 'html' ` , default: ` 'html' ` )
158
+ * ` space ` ([ ` Space ` ] [ space ] , default: ` 'html' ` )
157
159
— name of namespace
158
160
159
161
###### Returns
@@ -193,15 +195,15 @@ Yields:
193
195
### ` selectAll(selector, tree[, space]) `
194
196
195
197
Select all elements that match ` selector ` in the given ` tree ` .
196
- Searches the tree in * preorder* .
198
+ Searches the tree in * [ preorder] [ ] * .
197
199
198
200
###### Parameters
199
201
200
202
* ` selector ` (` string ` )
201
203
— CSS selector, such as (` h1 ` , ` a, b ` )
202
204
* ` tree ` ([ ` Node ` ] [ node ] , optional)
203
205
— tree to search
204
- * ` space ` (` 'svg' ` or ` 'html' ` , default: ` 'html' ` )
206
+ * ` space ` ([ ` Space ` ] [ space ] , default: ` 'html' ` )
205
207
— name of namespace
206
208
207
209
###### Returns
@@ -244,6 +246,16 @@ Yields:
244
246
children: [ { type: ' text' , value: ' Foxtrot' } ] } ]
245
247
```
246
248
249
+ ### ` Space `
250
+
251
+ Namespace (TypeScript type).
252
+
253
+ ###### Type
254
+
255
+ ``` ts
256
+ type Space = ' html' | ' svg'
257
+ ` ` `
258
+
247
259
## Support
248
260
249
261
* [x] ` *` (universal selector)
@@ -354,7 +366,7 @@ Yields:
354
366
## Types
355
367
356
368
This package is fully typed with [TypeScript][].
357
- It exports the additional type ` Space ` .
369
+ It exports the additional type [ ` Space ` ][space] .
358
370
359
371
## Compatibility
360
372
@@ -452,3 +464,11 @@ abide by its terms.
452
464
[unist-util-visit]: https://github.com/syntax-tree/unist-util-visit
453
465
454
466
[unist-util-select]: https://github.com/syntax-tree/unist-util-select
467
+
468
+ [matches]: #matchesselector-node-space
469
+
470
+ [select]: #selectselector-tree-space
471
+
472
+ [selectall]: #selectallselector-tree-space
473
+
474
+ [space]: #space
0 commit comments