Permalink
Browse files

fix #60 typings

  • Loading branch information...
1 parent 8214745 commit 6313322abdefc5d684744d01e4e1c96221acd7eb @leizongmin committed Dec 2, 2016
Showing with 25 additions and 4 deletions.
  1. +7 −0 typings/tsconfig.json
  2. +14 −0 typings/xss-tests.ts
  3. +4 −4 typings/xss.d.ts
@@ -0,0 +1,7 @@
+{
+ "compilerOptions": {
+ "strictNullChecks": true,
+ "noImplicitAny": true,
+ "module": "commonjs"
+ }
+}
View
@@ -23,6 +23,20 @@ console.log(xss('hello', {
css: false,
}));
+xss('hello');
+xss('hello', {
+ escapeHtml(str) {
+ return str.trim();
+ },
+ stripBlankChar: true,
+ onTag(tag, html, options) {
+ return html;
+ },
+ onIgnoreTag(tag, html) {
+
+ },
+});
+
interface ICustomWhiteList extends XSS.IWhiteList {
view?: string[];
View
@@ -86,9 +86,9 @@ declare namespace XSS {
video?: string[];
}
- export type OnTagHandler = (tag: string, html: string, options: {}) => string;
+ export type OnTagHandler = (tag: string, html: string, options: {}) => string | void;
- export type OnTagAttrHandler = (tag: string, name: string, value: string) => string;
+ export type OnTagAttrHandler = (tag: string, name: string, value: string) => string | void;
export type SafeAttrValueHandler = (tag: string, name: string, value: string, cssFilter: ICSSFilter) => string;
@@ -106,7 +106,7 @@ declare module 'xss' {
onIgnoreTag(tag: string, html: string, options: {
position: number;
isClosing: boolean;
- });
+ }): string;
remove(html: string): string;
};
@@ -119,7 +119,7 @@ declare module 'xss' {
(html: string, options?: XSS.IFilterXSSOptions): string;
FilterXSS: typeof FilterXSS;
- parseTag(html: string, onTag: (sourcePosition: number, position: number, tag: string, html: string, isClosing: boolean) => string, escapeHtml: EscapeHandler): string;
+ parseTag(html: string, onTag: (sourcePosition: number, position: number, tag: string, html: string, isClosing: boolean) => string, escapeHtml: XSS.EscapeHandler): string;
parseAttr(html: string, onAttr: (name: string, value: string) => string): string;
whiteList: XSS.IWhiteList;
getDefaultWhiteList(): XSS.IWhiteList;

0 comments on commit 6313322

Please sign in to comment.