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
You can try something like:
var nodes = []; var element = document.getElementById('yourelement'); nodes.push(element); while(element.parentNode) { nodes.unshift(element.parentNode); element = element.parentNode; }