Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
33 lines
628 B
Plaintext
33 lines
628 B
Plaintext
/**
|
||
* cssfilter
|
||
*
|
||
* @author 老雷<leizongmin@gmail.com>
|
||
*/
|
||
|
||
var DEFAULT = require('./default');
|
||
var FilterCSS = require('./css');
|
||
|
||
|
||
/**
|
||
* XSS过滤
|
||
*
|
||
* @param {String} css 要过滤的CSS代码
|
||
* @param {Object} options 选项:whiteList, onAttr, onIgnoreAttr
|
||
* @return {String}
|
||
*/
|
||
function filterCSS (html, options) {
|
||
var xss = new FilterCSS(options);
|
||
return xss.process(html);
|
||
}
|
||
|
||
|
||
// 输出
|
||
exports = module.exports = filterCSS;
|
||
exports.FilterCSS = FilterCSS;
|
||
for (var i in DEFAULT) exports[i] = DEFAULT[i];
|
||
|
||
// 在浏览器端使用
|
||
if (typeof window !== 'undefined') {
|
||
window.filterCSS = module.exports;
|
||
}
|