src/overlay.js
function getIndexOfType(element) {
  let index = 0;
  let child;
  while ((child = element.previousElementSibling)) {
    if (child.tagName === element.tagName) {
      index++;
    }
  }
  return index;
}
function getIndexOfType(element) {
  let index = 0;
  let child;
  while ((child = element.previousElementSibling)) {
    if (child.tagName === element.tagName) {
      index++;
    }
  }
  return index;
}
function getIndexOfType ( element ) { let index = 0 ; let child ; while ( ( child = element . previousElementSibling ) ) { if ( child . tagName === element . tagName ) { index ++ ; } } return index ; }
Get the index of the element among siblings of the same type.
Get the index of the element among siblings of the same type .