mirror of
https://github.com/holo-gfx/mangadex.git
synced 2024-11-28 20:48:21 -05:00
16 lines
424 B
JavaScript
16 lines
424 B
JavaScript
/* closest */
|
|
if (!Element.prototype.matches) {
|
|
Element.prototype.matches = Element.prototype.msMatchesSelector ||
|
|
Element.prototype.webkitMatchesSelector;
|
|
}
|
|
if (!Element.prototype.closest) {
|
|
Element.prototype.closest = function(s) {
|
|
var el = this;
|
|
|
|
do {
|
|
if (el.matches(s)) return el;
|
|
el = el.parentElement || el.parentNode;
|
|
} while (el !== null && el.nodeType === 1);
|
|
return null;
|
|
};
|
|
} |