docs: correct empty whiteList typing in examples

This commit is contained in:
aprilandjan
2021-02-26 19:22:01 +08:00
parent be1d80c89d
commit 3860fe7cca
3 changed files with 3 additions and 3 deletions

View File

@@ -455,7 +455,7 @@ img1, img2, img3, img4
```javascript
var source = "<strong>hello</strong><script>alert(/xss/);</script>end";
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

View File

@@ -442,7 +442,7 @@ img1, img2, img3, img4
```javascript
var source = "<strong>hello</strong><script>alert(/xss/);</script>end";
var html = xss(source, {
whiteList: [], // 白名单为空,表示过滤所有标签
whiteList: {}, // 白名单为空,表示过滤所有标签
stripIgnoreTag: true, // 过滤所有非白名单标签的HTML
stripIgnoreTagBody: ["script"] // script标签较特殊需要过滤标签中间的内容
});

View File

@@ -8,7 +8,7 @@ var xss = require('../');
var source = '<strong>hello</strong><script>alert(/xss/);</script>end';
var html = xss(source, {
whiteList: [], // 白名单为空,表示过滤所有标签
whiteList: {}, // 白名单为空,表示过滤所有标签
stripIgnoreTag: true, // 过滤所有非白名单标签的HTML
stripIgnoreTagBody: ['script'] // script标签较特殊需要过滤标签中间的内容
});