Rework website with bulma instead of bootstrap #6
|
@ -1,22 +1,16 @@
|
||||||
function registerFlashCloseButtons() {
|
function registerFlashCloseButtons() {
|
||||||
const flashButtons = document.querySelectorAll(".notification .delete");
|
const flashButtons = document.querySelectorAll(".notification .delete");
|
||||||
|
|
||||||
flashButtons.forEach((button) => {
|
for (const flashButton of flashButtons) {
|
||||||
const flash = button.parentNode;
|
if (flashButton.parentNode === null) {
|
||||||
|
throw new Error("invalid flash button");
|
||||||
if (flash === null) {
|
|
||||||
console.error(
|
|
||||||
"Unreachable because our `querySelector` includes a parent; something went very wrong"
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const flash = flashButton.parentNode;
|
||||||
|
|
||||||
flash.addEventListener("click", () => {
|
flash.addEventListener("click", () => {
|
||||||
if (flash.parentNode === null) {
|
if (flash.parentNode === null) {
|
||||||
console.error(
|
throw new Error("invalid flash message");
|
||||||
"Notification not placed in DOM; something went very wrong"
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flash.parentNode.removeChild(flash);
|
flash.parentNode.removeChild(flash);
|
||||||
|
@ -38,7 +32,7 @@ function registerFlashCloseButtons() {
|
||||||
const block = flash.parentNode;
|
const block = flash.parentNode;
|
||||||
flash.parentNode.parentNode.removeChild(block);
|
flash.parentNode.parentNode.removeChild(block);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerNavCollapseButtons() {
|
function registerNavCollapseButtons() {
|
||||||
|
|
Reference in a new issue