Skip to content

Commit 6b9a6e3

Browse files
committed
api.modal.confirm fixed for cross-browser compatibility
1 parent 83ad41c commit 6b9a6e3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/js/api.library.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,12 @@ api.modal.confirm = function (pMessage, pCallbackMethod, pCallbackParams) {
511511
$("#modal-confirm").find(".modal-body > p").empty().html(pMessage);
512512

513513
$("#modal-confirm").find("[name=confirm]").once("click", function () {
514-
// Close the Modal
515-
$("#modal-confirm").modal('hide');
516514
// Must wait for the async transition to finsh before invoking the callback function that may be a cascade confirm
517-
// Consider refactoring by cloning the confir modal instead.
518-
new Promise(resolve => setTimeout(resolve, 100)).then(() => { pCallbackMethod(pCallbackParams); });
515+
$("#modal-confirm").modal('hide').delay(100).queue(function () {
516+
// https://stackoverflow.com/questions/10860171/run-function-after-delay
517+
pCallbackMethod(pCallbackParams);
518+
$(this).dequeue();
519+
});
519520
});
520521

521522
// Force the modal to re-initialise before displaying in case of cascade confirm modals

0 commit comments

Comments
 (0)