From a9aa38c4c4ab7291341cd0a5ceb1225350623138 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 8 Sep 2020 17:23:41 +0200 Subject: [PATCH] Prevent the setup callback for page actions to be executed twice --- .../install/files/js/WoltLabSuite/Core/Ui/Page/Action.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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. -- 2.20.1