Skip to content

Commit

Permalink
Guard against bootstrap variable not being defined; fixes #2612
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer authored and bess committed Mar 16, 2022
1 parent bf5d37d commit a4131f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/javascript/blacklight/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ modal.receiveAjax = function (contents) {
}

modal.hide = function(el) {
if (bootstrap.Modal.VERSION >= "5") {
if (bootstrap && bootstrap.Modal && bootstrap.Modal.VERSION >= "5") {
bootstrap.Modal.getOrCreateInstance(el || document.querySelector(Blacklight.modal.modalSelector)).hide();
} else {
$(el || modal.modalSelector).modal('hide');
}
}

modal.show = function(el) {
if (bootstrap.Modal.VERSION >= "5") {
if (bootstrap && bootstrap.Modal && bootstrap.Modal.VERSION >= "5") {
bootstrap.Modal.getOrCreateInstance(el || document.querySelector(Blacklight.modal.modalSelector)).show();
} else {
$(el || modal.modalSelector).modal('show');
Expand Down

0 comments on commit a4131f8

Please sign in to comment.