8
8
[ ![ Backers] [ backers-badge ]] [ collective ]
9
9
[ ![ Chat] [ chat-badge ]] [ chat ]
10
10
11
- [ ** hast** ] [ hast ] utility to check if an [ * element* ] [ element ] is
12
- [ * labelable* ] [ spec ] .
11
+ [ hast] [ ] utility to check if a node is [ * labelable* ] [ spec ] .
13
12
14
- ## Install
13
+ ## Contents
14
+
15
+ * [ What is this?] ( #what-is-this )
16
+ * [ When should I use this?] ( #when-should-i-use-this )
17
+ * [ Install] ( #install )
18
+ * [ Use] ( #use )
19
+ * [ API] ( #api )
20
+ * [ ` labelable(node) ` ] ( #labelablenode )
21
+ * [ Types] ( #types )
22
+ * [ Compatibility] ( #compatibility )
23
+ * [ Security] ( #security )
24
+ * [ Related] ( #related )
25
+ * [ Contribute] ( #contribute )
26
+ * [ License] ( #license )
27
+
28
+ ## What is this?
15
29
16
- This package is [ ESM only ] ( https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c ) :
17
- Node 12+ is needed to use it and it must be ` import ` ed instead of ` require ` d .
30
+ This package is a small utility that checks if a node is labelable according to
31
+ HTML .
18
32
19
- [ npm] [ ] :
33
+ ## When should I use this?
34
+
35
+ This utility is super niche, if you’re here you probably know what you’re
36
+ looking for!
37
+
38
+ ## Install
39
+
40
+ This package is [ ESM only] [ esm ] .
41
+ In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [ npm] [ ] :
20
42
21
43
``` sh
22
44
npm install hast-util-labelable
23
45
```
24
46
47
+ In Deno with [ ` esm.sh ` ] [ esmsh ] :
48
+
49
+ ``` js
50
+ import {labelable } from ' https://esm.sh/hast-util-labelable@2'
51
+ ```
52
+
53
+ In browsers with [ ` esm.sh ` ] [ esmsh ] :
54
+
55
+ ``` html
56
+ <script type =" module" >
57
+ import {labelable } from ' https://esm.sh/hast-util-labelable@2?bundle'
58
+ </script >
59
+ ```
60
+
25
61
## Use
26
62
27
63
``` js
@@ -40,7 +76,7 @@ labelable({
40
76
41
77
## API
42
78
43
- This package exports the following identifiers: ` labelable ` .
79
+ This package exports the identifier ` labelable ` .
44
80
There is no default export.
45
81
46
82
### ` labelable(node) `
@@ -53,11 +89,23 @@ Check if the given value is a [*labelable*][spec] [*element*][element].
53
89
54
90
###### Returns
55
91
56
- ` boolean ` — Whether ` node ` is a labelable element.
92
+ Whether ` node ` is a labelable element ( ` boolean ` ) .
57
93
Labelable nodes have a ` tagName ` set to ` button ` , ` keygen ` ,
58
94
` meter ` , ` output ` , ` progress ` , ` select ` , ` textarea ` , and ` input `
59
95
(excluding ` [type=hidden] ` ).
60
96
97
+ ## Types
98
+
99
+ This package is fully typed with [ TypeScript] [ ] .
100
+ It exports no additional types.
101
+
102
+ ## Compatibility
103
+
104
+ Projects maintained by the unified collective are compatible with all maintained
105
+ versions of Node.js.
106
+ As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
107
+ Our projects sometimes work with older versions, but this is not guaranteed.
108
+
61
109
## Security
62
110
63
111
` hast-util-labelable ` does not change the syntax tree so there are no openings
@@ -69,21 +117,21 @@ for [cross-site scripting (XSS)][xss] attacks.
69
117
— check if a node is a (certain) element
70
118
* [ ` hast-util-has-property ` ] ( https://github.com/syntax-tree/hast-util-has-property )
71
119
— check if a node has a property
72
- * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-body-ok-link )
120
+ * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-body-ok-link )
73
121
— check if a node is “Body OK” link element
74
- * [ ` hast-util-is-conditional-comment ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-conditional-comment )
122
+ * [ ` hast-util-is-conditional-comment ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-conditional-comment )
75
123
— check if a node is a conditional comment
76
- * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-link )
124
+ * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-link )
77
125
— check if a node is a CSS link element
78
- * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-style )
126
+ * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-style )
79
127
— check if a node is a CSS style element
80
128
* [ ` hast-util-embedded ` ] ( https://github.com/syntax-tree/hast-util-embedded )
81
129
— check if a node is an embedded element
82
130
* [ ` hast-util-heading ` ] ( https://github.com/syntax-tree/hast-util-heading )
83
131
— check if a node is a heading element
84
132
* [ ` hast-util-interactive ` ] ( https://github.com/syntax-tree/hast-util-interactive )
85
133
— check if a node is interactive
86
- * [ ` hast-util-is-javascript ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-javascript )
134
+ * [ ` hast-util-is-javascript ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-javascript )
87
135
— check if a node is a JavaScript script element
88
136
* [ ` hast-util-phrasing ` ] ( https://github.com/syntax-tree/hast-util-phrasing )
89
137
— check if a node is phrasing content
@@ -98,8 +146,8 @@ for [cross-site scripting (XSS)][xss] attacks.
98
146
99
147
## Contribute
100
148
101
- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
102
- started.
149
+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
150
+ ways to get started.
103
151
See [ ` support.md ` ] [ support ] for ways to get help.
104
152
105
153
This project has a [ code of conduct] [ coc ] .
@@ -140,15 +188,23 @@ abide by its terms.
140
188
141
189
[ npm ] : https://docs.npmjs.com/cli/install
142
190
191
+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
192
+
193
+ [ esmsh ] : https://esm.sh
194
+
195
+ [ typescript ] : https://www.typescriptlang.org
196
+
143
197
[ license ] : license
144
198
145
199
[ author ] : https://wooorm.com
146
200
147
- [ contributing ] : https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
201
+ [ health ] : https://github.com/syntax-tree/.github
202
+
203
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing.md
148
204
149
- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD /support.md
205
+ [ support ] : https://github.com/syntax-tree/.github/blob/main /support.md
150
206
151
- [ coc ] : https://github.com/syntax-tree/.github/blob/HEAD /code-of-conduct.md
207
+ [ coc ] : https://github.com/syntax-tree/.github/blob/main /code-of-conduct.md
152
208
153
209
[ spec ] : https://html.spec.whatwg.org/#category-label
154
210
0 commit comments