Skip to content

Commit 172c480

Browse files
committed
feat: 🎸 sanitize HTML in createElement
1 parent f17e926 commit 172c480

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/modules/html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
var el = document.createElement(tagName);
5050
if (opt.className) el.className = opt.className;
5151
if (opt.innerHTML) {
52-
el.innerHTML = opt.innerHTML;
52+
el.innerHTML = DOMPurify.sanitize(opt.innerHTML);
5353
var scripts = el.getElementsByTagName("script");
5454
for (var i = scripts.length; i-- > 0; ) {
5555
scripts[i].parentNode.removeChild(scripts[i]);

src/node.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ global.atob = require("atob");
22
global.btoa = require("btoa");
33
global.canvg = require("canvg");
44
global.GifReader = require("omggif").GifReader;
5+
global.DOMPurify = require("dompurify")

0 commit comments

Comments
 (0)