@@ -159,6 +159,7 @@ import deepmerge from 'deepmerge'
159159import {h } from ' hastscript'
160160import {defaultSchema , sanitize } from ' hast-util-sanitize'
161161
162+ // This allows `className` on all elements.
162163const schema = deepmerge (defaultSchema, {attributes: {' *' : [' className' ]}})
163164
164165const tree = sanitize (h (' div' , {className: [' foo' ]}), schema)
@@ -229,16 +230,16 @@ For example:
229230
230231``` js
231232attributes: {
232- a: [' href ' ],
233- // …
234- img : [ ' src ' , ' longDesc ' ],
233+ a: [
234+ ' ariaDescribedBy ' , ' ariaLabel ' , ' ariaLabelledBy ' , /* … */ , ' href '
235+ ],
235236 // …
236237 ' *' : [
237238 ' abbr' ,
238239 ' accept' ,
239240 ' acceptCharset' ,
240241 // …
241- ' vSpace ' ,
242+ ' vAlign ' ,
242243 ' value' ,
243244 ' width'
244245 ]
@@ -269,7 +270,7 @@ List of [*property names*][name] that clobber (`Array<string>`, default:
269270For example:
270271
271272``` js
272- clobber: [' id' , ' name' ]
273+ clobber: [' ariaDescribedBy ' , ' ariaLabelledBy ' , ' id' , ' name' ]
273274```
274275
275276###### ` clobberPrefix `
@@ -297,9 +298,9 @@ For example:
297298
298299``` js
299300protocols: {
300- href : [' http' , ' https' , ' irc ' , ' ircs ' , ' mailto ' , ' xmpp ' ],
301+ cite : [' http' , ' https' ],
301302 // …
302- longDesc : [' http' , ' https' ]
303+ src : [' http' , ' https' ]
303304}
304305```
305306
@@ -349,12 +350,10 @@ For example:
349350``` js
350351tagNames: [
351352 ' a' ,
352- ' abbr' ,
353353 ' b' ,
354354 // …
355355 ' ul' ,
356- ' var' ,
357- ' wbr'
356+ ' var'
358357]
359358```
360359
@@ -365,15 +364,21 @@ It exports the additional type [`Schema`][api-schema].
365364
366365## Compatibility
367366
368- Projects maintained by the unified collective are compatible with all maintained
367+ Projects maintained by the unified collective are compatible with maintained
369368versions 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.
372374
373375## Security
374376
375377By 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
377382[ cross-site scripting (XSS)] [ xss ] attack.
378383
379384Use ` hast-util-sanitize ` after the last unsafe thing: everything after it could
@@ -412,9 +417,9 @@ abide by its terms.
412417
413418[ downloads ] : https://www.npmjs.com/package/hast-util-sanitize
414419
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
416421
417- [ size ] : https://bundlephobia .com/result?p =hast-util-sanitize
422+ [ size ] : https://bundlejs .com/?q =hast-util-sanitize
418423
419424[ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
420425
0 commit comments