Skip to content

Commit

Permalink
feat: 馃幐 sanitize HTML in createElement
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamGold committed Jul 9, 2020
1 parent f17e926 commit d52b628
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/modules/html.js
Expand Up @@ -49,11 +49,7 @@
var el = document.createElement(tagName);
if (opt.className) el.className = opt.className;
if (opt.innerHTML) {
el.innerHTML = opt.innerHTML;
var scripts = el.getElementsByTagName("script");
for (var i = scripts.length; i-- > 0; ) {
scripts[i].parentNode.removeChild(scripts[i]);
}
el.innerHTML = DOMPurify.sanitize(opt.innerHTML);
}
for (var key in opt.style) {
el.style[key] = opt.style[key];
Expand Down
1 change: 1 addition & 0 deletions src/node.js
Expand Up @@ -2,3 +2,4 @@ global.atob = require("atob");
global.btoa = require("btoa");
global.canvg = require("canvg");
global.GifReader = require("omggif").GifReader;
global.DOMPurify = require("dompurify")

0 comments on commit d52b628

Please sign in to comment.