mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 18:24:14 +01:00
18 lines
441 B
JavaScript
18 lines
441 B
JavaScript
|
// compat: IE11
|
||
|
if (!Element.prototype.matches) {
|
||
|
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
||
|
}
|
||
|
|
||
|
// compat: IE11
|
||
|
if (!Element.prototype.closest) {
|
||
|
Element.prototype.closest = function (s) {
|
||
|
let el = this;
|
||
|
|
||
|
do {
|
||
|
if (el.matches(s)) return el;
|
||
|
el = el.parentElement || el.parentNode;
|
||
|
} while (el !== null && el.nodeType === 1);
|
||
|
return null;
|
||
|
};
|
||
|
}
|