From: Matthias Schmidt Date: Mon, 22 Aug 2016 15:37:39 +0000 (+0200) Subject: Harden UiSimpleDropdown.destroy() against changed DOM X-Git-Tag: 3.0.0_Beta_1~576^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fd5b9debf1538630fbe15844aff4c1930e068552;p=GitHub%2FWoltLab%2FWCF.git Harden UiSimpleDropdown.destroy() against changed DOM --- 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);