* update minor deps * update minor deps * update major deps * fix eslint warnings
18 lines
596 B
TypeScript
18 lines
596 B
TypeScript
if (!Element.prototype.matches) {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
Element.prototype.matches = (Element.prototype as any).msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
}
|
|
|
|
if (!Element.prototype.closest) {
|
|
Element.prototype.closest = function(s: string) {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-this-alias
|
|
let el: any = this;
|
|
|
|
do {
|
|
if (el.matches(s)) return el;
|
|
el = el.parentElement || el.parentNode;
|
|
} while (el !== null && el.nodeType === 1);
|
|
return null;
|
|
};
|
|
}
|