redefine closest func

This commit is contained in:
yonghyon
2024-02-01 10:57:14 +09:00
parent 7bf292c7c4
commit 2a1f97afb3

View File

@@ -13,6 +13,18 @@ let appElement = (
);
if (typeof window === "object") {
if (!window.Element.prototype.closest) {
window.Element.prototype.closest = function(selector) {
var element = this;
while (element) {
if (element.matches(selector)) {
return element;
}
element = element.parentElement;
}
return null;
};
}
window.store = store;
render(appElement, document.getElementById("root"));