mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-24 22:39:26 +01:00
12 lines
379 B
JavaScript
Vendored
12 lines
379 B
JavaScript
Vendored
import matches from './matches';
|
|
export default function closest(node, selector, stopAt) {
|
|
if (node.closest && !stopAt) node.closest(selector);
|
|
var nextNode = node;
|
|
|
|
do {
|
|
if (matches(nextNode, selector)) return nextNode;
|
|
nextNode = nextNode.parentElement;
|
|
} while (nextNode && nextNode !== stopAt && nextNode.nodeType === document.ELEMENT_NODE);
|
|
|
|
return null;
|
|
} |