From 1157860738441d3e21f2f2eb041b1029ab39631d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 24 Jun 2015 19:25:13 +0200 Subject: [PATCH] Fixed initialization of `UI/Dialog` and improved `close()` --- wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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."); -- 2.20.1