mirror of https://github.com/calzoneman/sync.git
Forgot to add file
This commit is contained in:
parent
fe2ec2c8d2
commit
5e2b0929a9
|
@ -0,0 +1,17 @@
|
|||
const allowed = ["iframe", "object", "param", "embed"];
|
||||
const tag_re = /<\s*\/?\s*([a-z]+)(\s*([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^"'>]*))*\s*>/ig;
|
||||
|
||||
function filter(str) {
|
||||
str = str.replace(tag_re, function (match, tag) {
|
||||
if(!~allowed.indexOf(tag.toLowerCase())) {
|
||||
return match.replace("<", "<").replace(">", ">");
|
||||
}
|
||||
return match;
|
||||
});
|
||||
str = str.replace(/(\bon\w*\s*=\s*('[^']*'|"[^"]"|[^\s><]*))/ig, function () {
|
||||
return "";
|
||||
});
|
||||
return str;
|
||||
}
|
||||
|
||||
exports.filter = filter;
|
Loading…
Reference in New Issue