From 3860fe7cca12ca0dd4d43be0c137e8a0c3cce155 Mon Sep 17 00:00:00 2001 From: aprilandjan Date: Fri, 26 Feb 2021 19:22:01 +0800 Subject: [PATCH] docs: correct empty whiteList typing in examples --- README.md | 2 +- README.zh.md | 2 +- example/strip_tag.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index df5e130..4868a40 100644 --- a/README.md +++ b/README.md @@ -455,7 +455,7 @@ img1, img2, img3, img4 ```javascript var source = "helloend"; var html = xss(source, { - whiteList: [], // empty, means filter out all tags + whiteList: {}, // empty, means filter out all tags stripIgnoreTag: true, // filter out all HTML not in the whitelist stripIgnoreTagBody: ["script"] // the script tag is a special case, we need // to filter out its content diff --git a/README.zh.md b/README.zh.md index 0111746..f923209 100644 --- a/README.zh.md +++ b/README.zh.md @@ -442,7 +442,7 @@ img1, img2, img3, img4 ```javascript var source = "helloend"; var html = xss(source, { - whiteList: [], // 白名单为空,表示过滤所有标签 + whiteList: {}, // 白名单为空,表示过滤所有标签 stripIgnoreTag: true, // 过滤所有非白名单标签的HTML stripIgnoreTagBody: ["script"] // script标签较特殊,需要过滤标签中间的内容 }); diff --git a/example/strip_tag.js b/example/strip_tag.js index c22645d..83a6cf6 100644 --- a/example/strip_tag.js +++ b/example/strip_tag.js @@ -8,7 +8,7 @@ var xss = require('../'); var source = 'helloend'; var html = xss(source, { - whiteList: [], // 白名单为空,表示过滤所有标签 + whiteList: {}, // 白名单为空,表示过滤所有标签 stripIgnoreTag: true, // 过滤所有非白名单标签的HTML stripIgnoreTagBody: ['script'] // script标签较特殊,需要过滤标签中间的内容 });