@@ -159,6 +159,7 @@ import deepmerge from 'deepmerge'
159
159
import {h } from ' hastscript'
160
160
import {defaultSchema , sanitize } from ' hast-util-sanitize'
161
161
162
+ // This allows `className` on all elements.
162
163
const schema = deepmerge (defaultSchema, {attributes: {' *' : [' className' ]}})
163
164
164
165
const tree = sanitize (h (' div' , {className: [' foo' ]}), schema)
@@ -229,16 +230,16 @@ For example:
229
230
230
231
``` js
231
232
attributes: {
232
- a: [' href ' ],
233
- // …
234
- img : [ ' src ' , ' longDesc ' ],
233
+ a: [
234
+ ' ariaDescribedBy ' , ' ariaLabel ' , ' ariaLabelledBy ' , /* … */ , ' href '
235
+ ],
235
236
// …
236
237
' *' : [
237
238
' abbr' ,
238
239
' accept' ,
239
240
' acceptCharset' ,
240
241
// …
241
- ' vSpace ' ,
242
+ ' vAlign ' ,
242
243
' value' ,
243
244
' width'
244
245
]
@@ -269,7 +270,7 @@ List of [*property names*][name] that clobber (`Array<string>`, default:
269
270
For example:
270
271
271
272
``` js
272
- clobber: [' id' , ' name' ]
273
+ clobber: [' ariaDescribedBy ' , ' ariaLabelledBy ' , ' id' , ' name' ]
273
274
```
274
275
275
276
###### ` clobberPrefix `
@@ -297,9 +298,9 @@ For example:
297
298
298
299
``` js
299
300
protocols: {
300
- href : [' http' , ' https' , ' irc ' , ' ircs ' , ' mailto ' , ' xmpp ' ],
301
+ cite : [' http' , ' https' ],
301
302
// …
302
- longDesc : [' http' , ' https' ]
303
+ src : [' http' , ' https' ]
303
304
}
304
305
```
305
306
@@ -349,12 +350,10 @@ For example:
349
350
``` js
350
351
tagNames: [
351
352
' a' ,
352
- ' abbr' ,
353
353
' b' ,
354
354
// …
355
355
' ul' ,
356
- ' var' ,
357
- ' wbr'
356
+ ' var'
358
357
]
359
358
```
360
359
@@ -365,15 +364,21 @@ It exports the additional type [`Schema`][api-schema].
365
364
366
365
## Compatibility
367
366
368
- Projects maintained by the unified collective are compatible with all maintained
367
+ Projects maintained by the unified collective are compatible with maintained
369
368
versions of Node.js.
370
- As of now, that is Node.js 14.14+ and 16.0+.
371
- Our projects sometimes work with older versions, but this is not guaranteed.
369
+
370
+ When we cut a new major release, we drop support for unmaintained versions of
371
+ Node.
372
+ This means we try to keep the current release line, ` hast-util-sanitize@^4 ` ,
373
+ compatible with Node.js 12.
372
374
373
375
## Security
374
376
375
377
By default, ` hast-util-sanitize ` will make everything safe to use.
376
- But when used incorrectly, deviating from the defaults can open you up to a
378
+ Assuming you understand that certain attributes (including a limited set of
379
+ classes) can be generated by users, and you write your CSS (and JS)
380
+ accordingly.
381
+ When used incorrectly, deviating from the defaults can open you up to a
377
382
[ cross-site scripting (XSS)] [ xss ] attack.
378
383
379
384
Use ` hast-util-sanitize ` after the last unsafe thing: everything after it could
@@ -412,9 +417,9 @@ abide by its terms.
412
417
413
418
[ downloads ] : https://www.npmjs.com/package/hast-util-sanitize
414
419
415
- [ size-badge ] : https://img.shields.io/bundlephobia/minzip/ hast-util-sanitize.svg
420
+ [ size-badge ] : https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q= hast-util-sanitize
416
421
417
- [ size ] : https://bundlephobia .com/result?p =hast-util-sanitize
422
+ [ size ] : https://bundlejs .com/?q =hast-util-sanitize
418
423
419
424
[ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
420
425
0 commit comments