From: Alexander Ebert Date: Wed, 24 Jun 2015 17:25:13 +0000 (+0200) Subject: Fixed initialization of `UI/Dialog` and improved `close()` X-Git-Tag: 3.0.0_Beta_1~2253 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1157860738441d3e21f2f2eb041b1029ab39631d;p=GitHub%2FWoltLab%2FWCF.git Fixed initialization of `UI/Dialog` and improved `close()` --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js b/wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js index aafaf56fb9..8e445e8e3c 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js @@ -101,7 +101,7 @@ define( setupData.source = document.createDocumentFragment(); setupData.source.appendChild(dialogElement); } - else if (typeof setupData.source === null) { + else if (setupData.source === null) { // `null` means there is no static markup and `html` should be used instead setupData.source = html; } @@ -439,9 +439,16 @@ define( /** * Closes a dialog identified by given id. * - * @param {string} id element id + * @param {(string|object)} id element id or callback object */ close: function(id) { + if (typeof id === 'object') { + var dialogData = _dialogObjects.get(id); + if (dialogData !== undefined) { + id = dialogData.id; + } + } + var data = _dialogs.get(id); if (data === undefined) { throw new Error("Expected a valid dialog id, '" + id + "' does not match any active dialog.");