document.addEventListener('click', e => {
const path = e.composedPath();
console.log(path);
});
composedPath() returns an array of elements through which the event will pass during its propagation path, from the target element up through its ancestors to the window object. This includes elements in both light and shadow DOM if the event is composed. This method is particularly useful for understanding the event's propagation path, debugging event handling, or implementing complex event delegation patterns that need to know about the entire event path.