From bb0bfd2b2f55848a57ec5d3f72638dc77156f99f Mon Sep 17 00:00:00 2001 From: Ayo Date: Thu, 1 Jun 2023 12:59:27 +0200 Subject: [PATCH] fix: catch if browser doesn't have Sanitizer --- assets/js/webmention-utils.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/js/webmention-utils.mjs b/assets/js/webmention-utils.mjs index 6e72a8b..81e139c 100644 --- a/assets/js/webmention-utils.mjs +++ b/assets/js/webmention-utils.mjs @@ -62,8 +62,13 @@ function createRepliesBlock(replies, heading) { ).toLocaleDateString()}
`; const card = document.createElement("div"); card.className = "reply-card"; - const sanitizer = new Sanitizer(); - card.setHTML(reply.content.html, { sanitizer }); + if (typeof Sanitizer !== "undefined") { + const sanitizer = new Sanitizer(); + card.setHTML(reply.content.html, { sanitizer }); + } else { + // todo sanitize manually + card.innerHTML = reply.content.html; + } card.insertBefore(author, card.firstChild); cell.appendChild(card); repliesTable.append(row);