passive optimization

This commit is contained in:
Mylloon 2024-12-12 16:41:28 +01:00
parent 52e3674140
commit bf13da9178
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -19,11 +19,15 @@ const buildFileTree = (parent, data, location) => {
li.classList.add("collapsed"); li.classList.add("collapsed");
// Toggle collapsing on click // Toggle collapsing on click
li.addEventListener("click", function (e) { li.addEventListener(
"click",
(e) => {
if (e.target === li) { if (e.target === li) {
li.classList.toggle("collapsed"); li.classList.toggle("collapsed");
} }
}); },
{ passive: true }
);
} else { } else {
// File // File
const url = window.location.href.split("?")[0]; const url = window.location.href.split("?")[0];