Skip to content

Commit 8a9e898

Browse files
committed
Add improved docs
1 parent 6c9dc44 commit 8a9e898

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

lib/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
* Node to check (typically `Element`).
1616
* @returns {boolean}
1717
* Whether `node` is a labelable element.
18+
*
19+
* Labelable elements are `button`, `keygen`, `meter`, `output`, `progress`,
20+
* `select`, `textarea`, and `input` (excluding `[type=hidden]`).
1821
*/
1922
export function labelable(node) {
2023
return Boolean(

readme.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![Backers][backers-badge]][collective]
99
[![Chat][chat-badge]][chat]
1010

11-
[hast][] utility to check if a node is [*labelable*][spec].
11+
[hast][] utility to check if a node is a [*labelable element*][spec].
1212

1313
## Contents
1414

@@ -38,7 +38,7 @@ looking for!
3838
## Install
3939

4040
This 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
4444
npm install hast-util-labelable
@@ -76,23 +76,24 @@ labelable({
7676

7777
## API
7878

79-
This package exports the identifier `labelable`.
79+
This package exports the identifier [`labelable`][labelable].
8080
There is no default export.
8181

8282
### `labelable(node)`
8383

84-
Check if the given value is a [*labelable*][spec] [*element*][element].
84+
Check if the given value is a [*labelable element*][spec].
8585

8686
###### Parameters
8787

88-
* `node` (`*`, optional) — Value to check, probably [`Node`][node]
88+
* `node` ([`Node`][node])
89+
— node to check (typically [`Element`][element])
8990

9091
###### Returns
9192

9293
Whether `node` is a labelable element (`boolean`).
93-
Labelable nodes have a `tagName` set to `button`, `keygen`,
94-
`meter`, `output`, `progress`, `select`, `textarea`, and `input`
95-
(excluding `[type=hidden]`).
94+
95+
Labelable elements are `button`, `keygen`, `meter`, `output`, `progress`,
96+
`select`, `textarea`, and `input` (excluding `[type=hidden]`).
9697

9798
## Types
9899

@@ -103,7 +104,7 @@ It exports no additional types.
103104

104105
Projects maintained by the unified collective are compatible with all maintained
105106
versions of Node.js.
106-
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
107+
As of now, that is Node.js 14.14+ and 16.0+.
107108
Our projects sometimes work with older versions, but this is not guaranteed.
108109

109110
## Security
@@ -215,3 +216,5 @@ abide by its terms.
215216
[element]: https://github.com/syntax-tree/hast#element
216217

217218
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
219+
220+
[labelable]: #labelablenode

0 commit comments

Comments
 (0)