From 55ec78cec80bf0c1ae2133257a4c26b023e99c0d Mon Sep 17 00:00:00 2001 From: Gustavo Penna Date: Wed, 13 Apr 2022 16:34:59 -0300 Subject: [PATCH] Changed "target" to "currentTarget". This resolves conflicts when clicking an icon inside a link object. --- js/csrfprotector.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/csrfprotector.js b/js/csrfprotector.js index ac58c55..4150833 100644 --- a/js/csrfprotector.js +++ b/js/csrfprotector.js @@ -305,7 +305,7 @@ function csrfprotector_init() { for (var i = 0; i < document.links.length; i++) { document.links[i].addEventListener("mousedown", function (event) { - var href = event.target.href; + var href = event.currentTarget.href; if (typeof href !== "string") { return; } @@ -333,9 +333,9 @@ function csrfprotector_init() { url += `?${CSRFP.CSRFP_TOKEN}=${token}`; } - event.target.href = url; + event.currentTarget.href = url; if (hash) { - event.target.href += `#${hash}`; + event.currentTarget.href += `#${hash}`; } }); }