Apparently isn’t any node.index
property built-in, so here’s how to find it, in case I need it again:
function indexOf(node)
{
let i = 0;
while(node = node.previousElementSibling) i++;
return i;
}
{
let i = 0;
while(node = node.previousElementSibling) i++;
return i;
}
Source: StackOverflow