From: Alexander Ebert Date: Sun, 14 Dec 2014 01:20:55 +0000 (+0100) Subject: Fixed orphan language dropdown breaking new ones X-Git-Tag: 2.1.0_Beta_1~24 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=927616d249c0dc9ea2c8b305d7d87346f7be398d;p=GitHub%2FWoltLab%2FWCF.git Fixed orphan language dropdown breaking new ones --- 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(); },