From: Alexander Ebert Date: Tue, 8 Sep 2020 15:23:41 +0000 (+0200) Subject: Prevent the setup callback for page actions to be executed twice X-Git-Tag: 5.3.0_Beta_1~39^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a9aa38c4c4ab7291341cd0a5ceb1225350623138;p=GitHub%2FWoltLab%2FWCF.git Prevent the setup callback for page actions to be executed twice --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js index db018aaa6c..bdaf2cf674 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js @@ -32,6 +32,10 @@ define(['Dictionary', 'Language'], function (Dictionary, Language) { * Initializes the page action container. */ setup: function () { + if (_didInit) { + return; + } + _didInit = true; _wrapper = elCreate('div'); @@ -124,7 +128,7 @@ define(['Dictionary', 'Language'], function (Dictionary, Language) { * @param {string=} insertBeforeButton insert button before element identified by provided button name */ add: function (buttonName, button, insertBeforeButton) { - if (_didInit === false) this.setup(); + this.setup(); // The wrapper is required for backwards compatibility, because some implementations rely on a // dedicated parent element to insert elements, for example, for drop-down menus.