/ Gists / Composed Path
On gists

Composed Path

JavaScript

index.js Raw #

document.querySelector('button').addEventListener('click', (e) => {
  console.log(e.composedPath())
})

index.html Raw #

  <section>
    <article>
      <p>
        <span>
          <button>Click me</button>
        </span>
      </p>
    </article>
  </section>

output.js Raw #

> (9) [button, span, p, article, section, body, html, document, Window]