Skip to content

Commit

Permalink
Replace DomHelper.findParent with .closest
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoisin authored and fguillot committed Mar 11, 2024
1 parent d9d17f0 commit 826e4d6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion internal/ui/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ function isListView() {
function findEntry(element) {
if (isListView()) {
if (element) {
return DomHelper.findParent(element, "item");
return element.closest(".item")
} else {
return document.querySelector(".current-item");
}
Expand Down
10 changes: 0 additions & 10 deletions internal/ui/static/js/dom_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ class DomHelper {
return result;
}

static findParent(element, selector) {
for (; element && element !== document; element = element.parentNode) {
if (element.classList.contains(selector)) {
return element;
}
}

return null;
}

static hasPassiveEventListenerOption() {
var passiveSupported = false;

Expand Down
2 changes: 1 addition & 1 deletion internal/ui/static/js/touch_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TouchHandler {
return element;
}

return DomHelper.findParent(element, "entry-swipe");
return element.closest(".entry-swipe")
}

onItemTouchStart(event) {
Expand Down

0 comments on commit 826e4d6

Please sign in to comment.