blob: afb2f0d69563af62843820961794bdf9e390674d (
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 = function closest(selector, selectedElement = this) {
if (!selectedElement) return;
return selectedElement.matches(selector) ? selectedElement : Element.prototype.closest(selector, selectedElement.parentElement);
};
|