From 4ba74efcd05b054a8736400d08e30e7e022a748d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 18 Jun 2020 18:11:09 +0200 Subject: Add a-tag support in descriptions. --- src/ws/node.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/ws') diff --git a/src/ws/node.js b/src/ws/node.js index b99882b..4da3969 100644 --- a/src/ws/node.js +++ b/src/ws/node.js @@ -254,6 +254,17 @@ function checkHTML(html) var elements = doc.getElementsByTagName("*"); for(let element of elements) { + if(element.tagName == "A") + { + // Accept 'href' attribute in A tag only. + if(element.attributes.length > 1 || !element.hasAttribute("href")) + { + return false; + } + + continue; + } + // Check for allowed tag-names if(element.tagName != "P" && element.tagName != "EM" && @@ -276,7 +287,10 @@ function makeClickthrough(e) var elements = e.getElementsByTagName("*"); for(let element of elements) { - element.style.pointerEvents = "none"; // enable clickthrough to parent + if(element.tagName != "A") + { + element.style.pointerEvents = "none"; // enable clickthrough to parent + } } } -- cgit v1.2.3