blob: 6d9b0c4bc3ecab8f58e5adf4286a27c882818262 (
plain)
1
2
3
4
5
6
7
8
9
|
/* global Element */
/* eslint-disable consistent-return, max-len */
Element.prototype.matches = Element.prototype.matches || Element.prototype.msMatchesSelector;
Element.prototype.closest = Element.prototype.closest || function closest(selector, selectedElement = this) {
if (!selectedElement) return;
return selectedElement.matches(selector) ? selectedElement : Element.prototype.closest(selector, selectedElement.parentElement);
};
|