Fastest way to find the index of a child node in parent
Out of curiosity I ran your code against both jQuery’s .index() and my below code: function findRow3(node) { var i = 1; while (node = node.previousSibling) { if (node.nodeType === 1) { ++i } } return i; } Jump to jsperf results It turns out that jQuery is roughly 50% slower than your implementation (on … Read more