fix: match multiline scripts and styles

This commit is contained in:
Faris Ansari 2020-09-15 14:30:41 +05:30
parent 12476fee42
commit 7e2fed4ed2

View file

@ -34,7 +34,7 @@ frappe.dom = {
},
remove_script_and_style: function(txt) {
const evil_tags = ["script", "style", "noscript", "title", "meta", "base", "head"];
const regex = new RegExp(evil_tags.map(tag => `<${tag}>.*<\\/${tag}>`).join('|'));
const regex = new RegExp(evil_tags.map(tag => `<${tag}>.*<\\/${tag}>`).join('|'), 's');
if (!regex.test(txt)) {
// no evil tags found, skip the DOM method entirely!
return txt;