Merge pull request #28502 from WillGibson/add-parser-to-sanitize-html-ioptions

Add parser to sanitize-html's IOptions interface
This commit is contained in:
Mine Starks
2018-09-05 08:46:59 -07:00
committed by GitHub
2 changed files with 8 additions and 1 deletions
+4
View File
@@ -4,8 +4,11 @@
// Afshin Darian <https://github.com/afshin>
// BehindTheMath <https://github.com/BehindTheMath>
// Rinze de Laat <https://github.com/biermeester>
// Will Gibson <https://github.com/WillGibson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import {Options} from "htmlparser2";
export = sanitize;
declare function sanitize(dirty: string, options?: sanitize.IOptions): string;
@@ -51,6 +54,7 @@ declare namespace sanitize {
nonTextTags?: string[];
selfClosing?: string[];
transformTags?: { [tagName: string]: string | Transformer };
parser: Options;
}
+4 -1
View File
@@ -29,7 +29,10 @@ let options: sanitize.IOptions = {
allowedSchemesByTag: {
'a': ['http', 'https']
},
allowProtocolRelative: false
allowProtocolRelative: false,
parser: {
decodeEntities: true
}
};
let unsafe = '<div><script>alert("hello");</script></div>';