document.querySelector('button').addEventListener('click', (e) => {
console.log(e.composedPath())
})
<section>
<article>
<p>
<span>
<button>Click me</button>
</span>
</p>
</article>
</section>
> (9) [button, span, p, article, section, body, html, document, Window]