Hi, i'm currently migrating from jQuery to dom7, so thanks for that small library :)
Now I have a problem with event delegation.
Example:
// html
<nav class="menu">
<div data-action="action1">Test1</div>
<div data-action="action2"><button>Test2</button></div>
</nav>
// JS
$$('.menu').on('click', '[data-action]', (event) => {
const action = $$(event.currentTarget).attr('data-action');
// do somethin with action
});
this is working with jQuery, because event.currentTarget is the delegated element. But in dom7 this is always the parent element (menu). So this example is not working with dom7 when clicking the data-action elements.
Hi, i'm currently migrating from jQuery to dom7, so thanks for that small library :) Now I have a problem with event delegation.
Example:
this is working with jQuery, because event.currentTarget is the delegated element. But in dom7 this is always the parent element (menu). So this example is not working with dom7 when clicking the data-action elements.