更新README

This commit is contained in:
leizongmin
2012-09-19 20:28:35 +08:00
parent a8e62c4345
commit e24e92f342

View File

@@ -37,7 +37,8 @@ xss.onTagAttr = function (tag, attr, vaule) {
// tag当前标签名小写
// attr当前属性名小写
// value当前属性值
// 返回新的属性值,如果想使用默认的处理方式,不返回任何值即可
// 返回新的属性值,如果想使用默认的处理方式,不返回任何值即可
// 比如把属性值中的双引号替换为&quote;return value.replace(/"/g, '&quote;');
};
// 自定义处理不在白名单中的标签
@@ -45,6 +46,7 @@ xss.onIgnoreTag = function (tag, html) {
// tag当前标签名小写a
// html当前标签的HTML代码<a href="ooxx">
// 返回新的标签HTML代码如果想使用默认的处理方式不返回任何值即可
// 比如将标签替换为[removed]return '[removed]';
}
```
@@ -52,9 +54,9 @@ xss.onIgnoreTag = function (tag, html) {
```javascript
var options = {
whiteList: {}, // 若不指定则使用默认配置
onTagAttr: function () {}, // 若不指定则使用默认配置
onIgnoreTag: function () {} // 若不指定则使用默认配置
whiteList: {}, // 若不指定则使用默认配置可参考xss.whiteList
onTagAttr: function () {}, // 若不指定则使用默认配置可参考xss.onTagAttr
onIgnoreTag: function () {} // 若不指定则使用默认配置可参考xss.onIgnoreTag
};
var html = xss('<script>alert("xss");</script>', options);
console.log(html);