You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
441 B
18 lines
441 B
5 years ago
|
// 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;
|
||
|
};
|
||
|
}
|