How to set @click event handler to capture?

How to specify click event as capture? Currently, it looks like it is bubbling.

In the onclick() function below, I need to always get the parent from the “e.target” object whether I click on “exit” or “Click here to”.

<div id="parent" @click=${onclick}>
Click here to <span id="child">exit</span>
</div>
<script>
export default () => {
    const onclick = (e) => {
        //how to set event handler as capture so this would always give the parent element?
        console.log(e.target);
    }
});
</script>
  1. Don’t use arrow function
  2. That parent object where you assigned click listener will be available as this in event handler

Or try e.currentTarget

Thanks. I’ll just skip using @click or any event using that for now. I feel like the documentation is lacking on this, and overall in v6.

It’s still easier to use Dom7 $(’#my-el’).on(‘click’, function);