app/assets/javascripts/blacklight/blacklight.esm.js in blacklight-8.0.0.beta1 vs app/assets/javascripts/blacklight/blacklight.esm.js in blacklight-8.0.0.beta2

- old
+ new

@@ -261,13 +261,18 @@ modal.show(); }; // Add the passed in contents to the modal and display it. -modal.receiveAjax = function (contents) { + modal.receiveAjax = function (contents) { const domparser = new DOMParser(); const dom = domparser.parseFromString(contents, "text/html"); - const elements = dom.querySelectorAll(`${modal.containerSelector} > *`); + // If there is a containerSelector on the document, use it's children. + let elements = dom.querySelectorAll(`${modal.containerSelector} > *`); + if (element.length == 0) { + // If the containerSelector wasn't found, use the whole document + elements = dom.querySelectorAll(`*`); + } document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(...elements); modal.show(); };