code: function(nodes, formula, root, reverse, ofType) {
        if (nodes.length == 0) return [];
        if (formula == 'even') formula = '2n+0';
        if (formula == 'odd')  formula = '2n+1';
        var h = Selector.handlers, results = [], indexed = [], m;
        h.mark(nodes);
        for (var i = 0, node; node = nodes[i]; i++) {
          if (!node.parentNode._counted) {
            h.index(node.parentNode, reverse, ofType);
            indexed.push(node.parentNode);
          }
        }
        if (formula.match(/^\d+$/)) { // just a number
          formula = Number(formula);
          for (var i = 0, node; node = nodes[i]; i++)
            if (node.nodeIndex == formula) results.push(node);
        } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
          if (m[1] == "-") m[1] = -1;
          var a = m[1] ? Number(m[1]) : 1;
          var b = m[2] ? Number(m[2]) : 0;
          var indices = Selector.pseudos.getIndices(a, b, nodes.length);
          for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
            for (var j = 0; j < l; j++)
              if (node.nodeIndex == indices[j]) results.push(node);
          }
        }
        h.unmark(nodes);
        h.unmark(indexed);
        return results;
      }
docs: handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type