From: Alexander Ebert Date: Mon, 9 Jan 2017 17:07:57 +0000 (+0100) Subject: UiItemList was only partially destructed X-Git-Tag: 3.0.0~10 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=047d133674776471ab58bf1a004d3b255850fd64;p=GitHub%2FWoltLab%2FWCF.git UiItemList was only partially destructed --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js index 5a7c0811ae..53b5f90201 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js @@ -6,7 +6,7 @@ * @license GNU Lesser General Public License * @module WoltLabSuite/Core/Ui/ItemList */ -define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'EventKey', 'WoltLabSuite/Core/Ui/Suggestion'], function(Core, Dictionary, Language, DomTraverse, EventKey, UiSuggestion) { +define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'EventKey', 'WoltLabSuite/Core/Ui/Suggestion', 'Ui/SimpleDropdown'], function(Core, Dictionary, Language, DomTraverse, EventKey, UiSuggestion, UiSimpleDropdown) { "use strict"; var _activeId = ''; @@ -38,6 +38,23 @@ define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'EventKey', 'WoltLabSu throw new Error("Expected a valid element id, '" + elementId + "' is invalid."); } + // remove data from previous instance + if (_data.has(elementId)) { + var tmp = _data.get(elementId); + + for (var key in tmp) { + if (tmp.hasOwnProperty(key)) { + var el = tmp[key]; + if (el instanceof Element && el.parentNode) { + elRemove(el); + } + } + } + + UiSimpleDropdown.destroy(elementId); + _data.delete(elementId); + } + options = Core.extend({ // search parameters for suggestions ajax: {