update sanitize-html typing to 1.22.0 (#43002)

This commit is contained in:
tomotetra 2020-03-13 08:49:03 +09:00 committed by GitHub
parent 57fe2e635e
commit 06b0334e47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for sanitize-html 1.20.1
// Type definitions for sanitize-html 1.22.0
// Project: https://github.com/punkave/sanitize-html
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Afshin Darian <https://github.com/afshin>
@ -9,6 +9,7 @@
// Johan Davidsson <https://github.com/johandavidson>
// Jianrong Yu <https://github.com/YuJianrong>
// GP <https://github.com/paambaati>
// tomotetra <https://github.com/tomotetra>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@ -31,6 +32,8 @@ declare namespace sanitize {
type AllowedAttribute = string | { name: string; multiple?: boolean; values: string[] };
type DisallowedTagsModes = 'discard' | 'escape' | 'recursiveEscape';
interface IDefaults {
allowedAttributes: { [index: string]: AllowedAttribute[] };
allowedSchemes: string[];
@ -65,6 +68,7 @@ declare namespace sanitize {
selfClosing?: string[];
transformTags?: { [tagName: string]: string | Transformer };
parser?: Options;
disallowedTagsMode?: DisallowedTagsModes;
}

View File

@ -31,7 +31,8 @@ let options: sanitize.IOptions = {
allowedSchemesByTag: {
'a': ['http', 'https']
},
allowProtocolRelative: false
allowProtocolRelative: false,
disallowedTagsMode: 'escape'
};
let unsafe = '<div><script>alert("hello");</script></div>';