fix(components): replace initialization of components to prevent overrides

This commit is contained in:
Alexander Navarro 2024-12-27 13:03:23 -03:00
parent 37a1551699
commit 8cbd097389
4 changed files with 6 additions and 6 deletions

View file

@ -38,7 +38,7 @@ function toggleAccordion(item: HTMLElement, state: AccordionState) {
}
}
window.onload = () => {
document.addEventListener("DOMContentLoaded", () => {
qsa(".msp-accordion-item").forEach((item) => {
qs(".msp-accordion-header", item)?.addEventListener("click", (e) => {
e.preventDefault();
@ -50,4 +50,4 @@ window.onload = () => {
);
});
});
};
});

View file

@ -1,6 +1,6 @@
import { qs, qsa } from "../utils";
window.onload = () => {
document.addEventListener("DOMContentLoaded", () => {
qsa(".msp-offcanvas-toggle").forEach((item) => {
item.addEventListener("click", () => {
const target = item.dataset.mspTarget;
@ -18,4 +18,4 @@ window.onload = () => {
targetElement.classList.toggle("show");
});
});
};
});