From fd5b9debf1538630fbe15844aff4c1930e068552 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 22 Aug 2016 17:37:39 +0200 Subject: [PATCH] Harden UiSimpleDropdown.destroy() against changed DOM --- .../js/WoltLabSuite/Core/Ui/Dropdown/Simple.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js index 2bd4c4f88a..0eb7819672 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js @@ -281,10 +281,15 @@ define( return false; } - this.close(containerId); - - var menu = _menus.get(containerId); - _menus.parentNode.removeChild(menu); + try { + this.close(containerId); + + var menu = _menus.get(containerId); + _menus.parentNode.removeChild(menu); + } + catch (e) { + // the elements might not exist anymore thus ignore all errors cleaning up + } _menus['delete'](containerId); _dropdowns['delete'](containerId); -- 2.20.1