docs: correct empty whiteList typing in examples
This commit is contained in:
@@ -455,7 +455,7 @@ img1, img2, img3, img4
|
|||||||
```javascript
|
```javascript
|
||||||
var source = "<strong>hello</strong><script>alert(/xss/);</script>end";
|
var source = "<strong>hello</strong><script>alert(/xss/);</script>end";
|
||||||
var html = xss(source, {
|
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
|
stripIgnoreTag: true, // filter out all HTML not in the whitelist
|
||||||
stripIgnoreTagBody: ["script"] // the script tag is a special case, we need
|
stripIgnoreTagBody: ["script"] // the script tag is a special case, we need
|
||||||
// to filter out its content
|
// to filter out its content
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ img1, img2, img3, img4
|
|||||||
```javascript
|
```javascript
|
||||||
var source = "<strong>hello</strong><script>alert(/xss/);</script>end";
|
var source = "<strong>hello</strong><script>alert(/xss/);</script>end";
|
||||||
var html = xss(source, {
|
var html = xss(source, {
|
||||||
whiteList: [], // 白名单为空,表示过滤所有标签
|
whiteList: {}, // 白名单为空,表示过滤所有标签
|
||||||
stripIgnoreTag: true, // 过滤所有非白名单标签的HTML
|
stripIgnoreTag: true, // 过滤所有非白名单标签的HTML
|
||||||
stripIgnoreTagBody: ["script"] // script标签较特殊,需要过滤标签中间的内容
|
stripIgnoreTagBody: ["script"] // script标签较特殊,需要过滤标签中间的内容
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ var xss = require('../');
|
|||||||
|
|
||||||
var source = '<strong>hello</strong><script>alert(/xss/);</script>end';
|
var source = '<strong>hello</strong><script>alert(/xss/);</script>end';
|
||||||
var html = xss(source, {
|
var html = xss(source, {
|
||||||
whiteList: [], // 白名单为空,表示过滤所有标签
|
whiteList: {}, // 白名单为空,表示过滤所有标签
|
||||||
stripIgnoreTag: true, // 过滤所有非白名单标签的HTML
|
stripIgnoreTag: true, // 过滤所有非白名单标签的HTML
|
||||||
stripIgnoreTagBody: ['script'] // script标签较特殊,需要过滤标签中间的内容
|
stripIgnoreTagBody: ['script'] // script标签较特殊,需要过滤标签中间的内容
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user