1717* [ Install] ( #install )
1818* [ Use] ( #use )
1919* [ API] ( #api )
20- * [ ` parseSelector([ selector] [, defaultTagName]) ` ] ( #parseselectorselector-defaulttagname )
20+ * [ ` parseSelector(selector? [, defaultTagName]) ` ] ( #parseselectorselector-defaulttagname )
2121* [ Types] ( #types )
2222* [ Compatibility] ( #compatibility )
2323* [ Security] ( #security )
@@ -38,7 +38,7 @@ You probably want the more powerful [`hastscript`][hastscript] or
3838## Install
3939
4040This package is [ ESM only] [ esm ] .
41- In Node.js (version 12.20+, 14.14+, 16.0+, or 18 .0+), install with [ npm] [ ] :
41+ In Node.js (version 14.14+ and 16 .0+), install with [ npm] [ ] :
4242
4343``` sh
4444npm install hast-util-parse-selector
@@ -77,37 +77,39 @@ Yields:
7777
7878## API
7979
80- This package exports the identifier ` parseSelector ` .
80+ This package exports the identifier [ ` parseSelector ` ] [ parseselector ] .
8181There is no default export.
8282
83- ### ` parseSelector([ selector] [, defaultTagName]) `
83+ ### ` parseSelector(selector? [, defaultTagName]) `
8484
85- Create an [ * element * ] [ element ] [ * node * ] [ node ] from a simple CSS selector.
85+ Create a hast element from a simple CSS selector.
8686
8787###### Parameters
8888
8989* ` selector ` (` string ` , optional)
90- — can contain a tag name (` foo ` ), classes (` .bar ` ), and an ID (` #baz ` ),
91- multiple classes are allowed, and uses the last ID if multiple IDs are found
90+ — simple CSS selector, can contain a tag name (` foo ` ), classes (` .bar ` ),
91+ and an ID (` #baz ` ), multiple classes are allowed, uses the last ID if
92+ multiple IDs are found
9293* ` defaultTagName ` (` string ` , default: ` 'div' ` )
9394 — tag name to use if ` selector ` does not specify one
9495
9596###### Returns
9697
97- [ ` Element ` ] [ element ] .
98+ Built element ( [ ` Element ` ] [ element ] ) .
9899
99100## Types
100101
101102This package is fully typed with [ TypeScript] [ ] .
102103It exports no additional types.
104+
103105In TypeScript 4.2+, the type system can infer the tag name of literal
104106` selector ` s and knows that the return element has that name.
105107
106108## Compatibility
107109
108110Projects maintained by the unified collective are compatible with all maintained
109111versions of Node.js.
110- As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18 .0+.
112+ As of now, that is Node.js 14.14+ and 16 .0+.
111113Our projects sometimes work with older versions, but this is not guaranteed.
112114
113115## Security
@@ -194,8 +196,8 @@ abide by its terms.
194196
195197[ hast-util-from-selector ] : https://github.com/syntax-tree/hast-util-from-selector
196198
197- [ node ] : https://github.com/syntax-tree/hast#nodes
198-
199199[ element ] : https://github.com/syntax-tree/hast#element
200200
201201[ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
202+
203+ [ parseselector ] : #parseselectorselector-defaulttagname
0 commit comments