mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
11 lines
331 B
JavaScript
11 lines
331 B
JavaScript
function delegate(eventType, selector, handler, root) {
|
|
(root || document).addEventListener(eventType, function(event) {
|
|
const target = event.target.closest(selector);
|
|
if (target) {
|
|
if (handler.call(this, event) === false) {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
});
|
|
}
|