From: Joshua Rüsweg Date: Fri, 24 May 2019 13:59:24 +0000 (+0200) Subject: Optimize javascript code X-Git-Tag: 5.2.0_Alpha_1~76 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5596e170888fb8fd3fa91d277c12117073e6c413;p=GitHub%2FWoltLab%2FWCF.git Optimize javascript code See #2508 --- 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';