I mean an array of them. That is a chain from top HTML to destination element including the element itself.
for example for element it would b
A little shorter (and safer, since target may not be found):
target
var a = document.getElementById("target"); var els = []; while (a) { els.unshift(a); a = a.parentNode; }