docs: private int getElementIndex(Node node) {
          final String nodeName = node.getNodeName();
  
          int count = 1;
          for (Node previousSibling = node.getPreviousSibling();
                  previousSibling != null;
                  previousSibling = previousSibling.getPreviousSibling()) {
              if (previousSibling.getNodeType() == Node.ELEMENT_NODE
                      && previousSibling.getNodeName().equals(nodeName)) {
                  count++;
              }
          }
  
          return count;
      }