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
- [ * script-supporting* ] [ spec ] .
11
+ [ hast] [ ] utility to check if a node is [ * script-supporting* ] [ 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
+ * [ ` scriptSupporting(node) ` ] ( #scriptsupportingnode )
21
+ * [ Types] ( #types )
22
+ * [ Compatibility] ( #compatibility )
23
+ * [ Security] ( #security )
24
+ * [ Related] ( #related )
25
+ * [ Contribute] ( #contribute )
26
+ * [ License] ( #license )
27
+
28
+ ## What is this?
29
+
30
+ This package is a small utility that checks if a node is script-supporting
31
+ according to HTML.
15
32
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.
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
18
39
19
- [ npm] [ ] :
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-script-supporting
23
45
```
24
46
47
+ In Deno with [ ` esm.sh ` ] [ esmsh ] :
48
+
49
+ ``` js
50
+ import {scriptSupporting } from ' https://esm.sh/hast-util-script-supporting@2'
51
+ ```
52
+
53
+ In browsers with [ ` esm.sh ` ] [ esmsh ] :
54
+
55
+ ``` html
56
+ <script type =" module" >
57
+ import {scriptSupporting } from ' https://esm.sh/hast-util-script-supporting@2?bundle'
58
+ </script >
59
+ ```
60
+
25
61
## Use
26
62
27
63
``` js
@@ -43,13 +79,33 @@ scriptSupporting({
43
79
44
80
## API
45
81
46
- This package exports the following identifiers: ` scriptSupporting ` .
82
+ This package exports the identifier ` scriptSupporting ` .
47
83
There is no default export.
48
84
49
85
### ` scriptSupporting(node) `
50
86
51
87
Check if the given value is a [ * script-supporting* ] [ spec ] [ * element* ] [ element ] .
52
88
89
+ ###### Parameters
90
+
91
+ * ` node ` ([ ` Node ` ] [ node ] ) — node to check
92
+
93
+ ###### Returns
94
+
95
+ Whether the ` value ` is script-supporting (` boolean ` ).
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
+
53
109
## Security
54
110
55
111
` hast-util-script-supporting ` does not change the syntax tree so there are no
@@ -61,21 +117,21 @@ openings for [cross-site scripting (XSS)][xss] attacks.
61
117
— check if a node is a (certain) element
62
118
* [ ` hast-util-has-property ` ] ( https://github.com/syntax-tree/hast-util-has-property )
63
119
— check if a node has a property
64
- * [ ` 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 )
65
121
— check if a node is “Body OK” link element
66
- * [ ` 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 )
67
123
— check if a node is a conditional comment
68
- * [ ` 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 )
69
125
— check if a node is a CSS link element
70
- * [ ` 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 )
71
127
— check if a node is a CSS style element
72
128
* [ ` hast-util-embedded ` ] ( https://github.com/syntax-tree/hast-util-embedded )
73
129
— check if a node is an embedded element
74
130
* [ ` hast-util-heading ` ] ( https://github.com/syntax-tree/hast-util-heading )
75
131
— check if a node is a heading element
76
132
* [ ` hast-util-interactive ` ] ( https://github.com/syntax-tree/hast-util-interactive )
77
133
— check if a node is interactive
78
- * [ ` 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 )
79
135
— check if a node is a JavaScript script element
80
136
* [ ` hast-util-labelable ` ] ( https://github.com/syntax-tree/hast-util-labelable )
81
137
— check whether a node is labelable
@@ -90,8 +146,8 @@ openings for [cross-site scripting (XSS)][xss] attacks.
90
146
91
147
## Contribute
92
148
93
- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
94
- started.
149
+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
150
+ ways to get started.
95
151
See [ ` support.md ` ] [ support ] for ways to get help.
96
152
97
153
This project has a [ code of conduct] [ coc ] .
@@ -132,20 +188,30 @@ abide by its terms.
132
188
133
189
[ npm ] : https://docs.npmjs.com/cli/install
134
190
191
+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
192
+
193
+ [ esmsh ] : https://esm.sh
194
+
195
+ [ typescript ] : https://www.typescriptlang.org
196
+
135
197
[ license ] : license
136
198
137
199
[ author ] : https://wooorm.com
138
200
139
- [ 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
140
204
141
- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD /support.md
205
+ [ support ] : https://github.com/syntax-tree/.github/blob/main /support.md
142
206
143
- [ 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
144
208
145
209
[ spec ] : https://html.spec.whatwg.org/#script-supporting-elements
146
210
147
211
[ hast ] : https://github.com/syntax-tree/hast
148
212
149
213
[ element ] : https://github.com/syntax-tree/hast#element
150
214
215
+ [ node ] : https://github.com/syntax-tree/hast#nodes
216
+
151
217
[ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
0 commit comments