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 172c480
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
var el = document.createElement(tagName);
if (opt.className) el.className = opt.className;
if (opt.innerHTML) {
el.innerHTML = opt.innerHTML;
el.innerHTML = DOMPurify.sanitize(opt.innerHTML);
var scripts = el.getElementsByTagName("script");
for (var i = scripts.length; i-- > 0; ) {
scripts[i].parentNode.removeChild(scripts[i]);
Expand Down
1 change: 1 addition & 0 deletions src/node.js
Original file line number Diff line number Diff line change
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 172c480

Please sign in to comment.