Files
DefinitelyTyped/sanitize-html/sanitize-html-tests.ts
2016-04-27 21:53:46 -07:00

33 lines
703 B
TypeScript

import sanitizeHtml = require('sanitize-html');
var s: string;
var t: string;
t = sanitizeHtml(s);
t = sanitizeHtml(s, {
});
t = sanitizeHtml(s, {
allowedTags: ["a", "br"],
allowedSchemes: ["http"],
allowedAttributes: { "a": ["href"] },
allowedClasses: { "a": ["someclass"] },
transformTags: {
"a": "b",
"br": function(tagName: string, attributes: {[index: string]: string}): { tagName: string; attributes: {[index: string]: string};} {
return { tagName: tagName, attributes: attributes };
}
},
exclusiveFilter: {
"a": function(frame: {
tag: string;
attribs: { [index: string]: string };
text: string;
tagPosition: number;
}): boolean {
return false;
}
}
});