From f80bf36991d2681794e3e9afc6b77ac8af042631 Mon Sep 17 00:00:00 2001 From: Bad Date: Thu, 29 Oct 2020 11:09:15 +0100 Subject: [PATCH] Style fixes --- src/js/events/event.js | 1 - src/js/events/message.js | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/js/events/event.js b/src/js/events/event.js index 765c03a..8f5ff74 100644 --- a/src/js/events/event.js +++ b/src/js/events/event.js @@ -14,7 +14,6 @@ class MatrixEvent extends ElemJS { // predicates canGroup() { - //return this.data.type === "m.room.message" return false } diff --git a/src/js/events/message.js b/src/js/events/message.js index 05ccfdd..bbd1b15 100644 --- a/src/js/events/message.js +++ b/src/js/events/message.js @@ -8,7 +8,7 @@ const {MatrixEvent} = require("./event") const purifier = DOMPurify() purifier.addHook("uponSanitizeAttribute", (node, hookevent, config) => { - //If purifier already rejected an attribute there is no point in checking it + // If purifier already rejected an attribute there is no point in checking it if (hookevent.keepAttr === false) return; const allowedElementAttributes = { @@ -24,8 +24,8 @@ purifier.addHook("uponSanitizeAttribute", (node, hookevent, config) => { hookevent.keepAttr = allowed_attributes.indexOf(hookevent.attrName) > -1; }) -//Remove bad classes from our code element purifier.addHook("uponSanitizeElement", (node, hookevent, config) => { + // Remove bad classes from our code element if (node.tagName == "CODE") { node.classList.forEach(c => { if (!c.startsWith("language-")) { @@ -53,7 +53,7 @@ function cleanHTML(html) { return purifier.sanitize(html) } -//Here we put all the processing of the messages that isn't as likely to potentially lead to security issues +// Here we put all the processing of the messages that isn't as likely to potentially lead to security issues function postProcessElements(rootNode) { const element = rootNode.element element.querySelectorAll("code").forEach((n) => rootNode.child(new HighlightedCode(n)))