From 5596e170888fb8fd3fa91d277c12117073e6c413 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Fri, 24 May 2019 15:59:24 +0200 Subject: [PATCH] Optimize javascript code See #2508 --- .../files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js index 90ac4883b4..f498d24546 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js @@ -139,7 +139,7 @@ define( * @param {Element} element */ _enableMobileView: function(element) { - var messageFooterGroup = element.parentElement.parentElement.parentElement; + var messageFooterGroup = element.closest('.messageFooterGroup'); elShow(elBySel('.mobileReactButton', messageFooterGroup)); }, @@ -150,7 +150,7 @@ define( * @param {Element} element */ _disableMobileView: function(element) { - var messageFooterGroup = element.parentElement.parentElement.parentElement; + var messageFooterGroup = element.closest('.messageFooterGroup'); elHide(elBySel('.mobileReactButton', messageFooterGroup)); }, @@ -162,7 +162,7 @@ define( * @param {int} objectID */ _setupMobileView: function(element, objectID) { - var messageFooterGroup = element.parentElement.parentElement.parentElement; + var messageFooterGroup = element.closest('.messageFooterGroup'); var button = elCreate('button'); button.classList = 'mobileReactButton'; -- 2.20.1