From 927616d249c0dc9ea2c8b305d7d87346f7be398d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 14 Dec 2014 02:20:55 +0100 Subject: [PATCH] Fixed orphan language dropdown breaking new ones --- wcfsetup/install/files/js/WCF.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 53c2e17198..9232769c53 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1293,6 +1293,24 @@ WCF.Dropdown = { for (var $i = 0, $length = this._callbacks[containerID].length; $i < $length; $i++) { this._callbacks[containerID][$i](containerID, action); } + }, + + /** + * Destroies an existing dropdown menu. + * + * @param string containerID + * @return boolean + */ + destroy: function(containerID) { + if (this._dropdowns[containerID] === undefined) { + return false; + } + + this.close(containerID); + + this._menus[containerID].remove(); + delete this._menus[containerID]; + delete this._dropdowns[containerID]; } }; @@ -10590,6 +10608,7 @@ WCF.Language.Chooser = Class.extend({ this._dropdown.children('.dropdownToggle').empty().append($dropdownToggle); } + WCF.Dropdown.destroy(containerID + '-languageChooser'); WCF.Dropdown.init(); }, -- 2.20.1