Replace DomHelper.findParent with .closest
See https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
This commit is contained in:
parent
d9d17f0d69
commit
826e4d654f
3 changed files with 2 additions and 12 deletions
|
@ -571,7 +571,7 @@ function isListView() {
|
||||||
function findEntry(element) {
|
function findEntry(element) {
|
||||||
if (isListView()) {
|
if (isListView()) {
|
||||||
if (element) {
|
if (element) {
|
||||||
return DomHelper.findParent(element, "item");
|
return element.closest(".item")
|
||||||
} else {
|
} else {
|
||||||
return document.querySelector(".current-item");
|
return document.querySelector(".current-item");
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,16 +34,6 @@ class DomHelper {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static findParent(element, selector) {
|
|
||||||
for (; element && element !== document; element = element.parentNode) {
|
|
||||||
if (element.classList.contains(selector)) {
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static hasPassiveEventListenerOption() {
|
static hasPassiveEventListenerOption() {
|
||||||
var passiveSupported = false;
|
var passiveSupported = false;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TouchHandler {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DomHelper.findParent(element, "entry-swipe");
|
return element.closest(".entry-swipe")
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemTouchStart(event) {
|
onItemTouchStart(event) {
|
||||||
|
|
Loading…
Reference in a new issue