code: function getNthElementOfType(context, element, index) {
    let nthOfType = 0;
    for (let i = 0, child; (child = context.children[i]); i++) {
      if (child.nodeType === child.ELEMENT_NODE &&
          child.tagName.toLowerCase() === element.tagName.toLowerCase()) {
        if (nthOfType === index) {
          return child;
        }
        nthOfType++;
      }
    }
    return null;
  }
docs: Get n-th immediate child of context that is of the same type as element. XXX Use querySelector(':scope > ELEMENT:nth-of-type(index)'), when: 1) :scope is widely supported in more browsers and 2) it works with DocumentFragments.