mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Revert tracker logic. Bump search depth.
This commit is contained in:
parent
34757e7b2a
commit
938047ce45
@ -112,21 +112,22 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const callback = e => {
|
const callback = e => {
|
||||||
const findATagParent = rootElem => {
|
const findATagParent = (rootElem, maxSearchDepth) => {
|
||||||
let currentElement = rootElem;
|
let currentElement = rootElem;
|
||||||
|
for (let i = 0; i < maxSearchDepth; i++) {
|
||||||
while (currentElement) {
|
|
||||||
if (currentElement.tagName === 'A') {
|
if (currentElement.tagName === 'A') {
|
||||||
return currentElement;
|
return currentElement;
|
||||||
}
|
}
|
||||||
currentElement = currentElement.parentElement;
|
currentElement = currentElement.parentElement;
|
||||||
|
if (!currentElement) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const el = e.target;
|
const el = e.target;
|
||||||
const anchor = el.tagName === 'A' ? el : findATagParent(el);
|
const anchor = el.tagName === 'A' ? el : findATagParent(el, 10);
|
||||||
|
|
||||||
if (anchor) {
|
if (anchor) {
|
||||||
const { href, target } = anchor;
|
const { href, target } = anchor;
|
||||||
|
Loading…
Reference in New Issue
Block a user