author | Aryeh Gregor <AryehGregor+gitcommit@gmail.com> |
Mon, 01 Aug 2011 13:05:45 -0600 | |
changeset 478 | 1fc389b77696 |
parent 477 | 304204457dab |
child 479 | 1580a1b1f19d |
implementation.js |
--- a/implementation.js Mon Aug 01 12:57:26 2011 -0600 +++ b/implementation.js Mon Aug 01 13:05:45 2011 -0600 @@ -92,9 +92,10 @@ function getDescendants(node) { var descendants = []; - for (var i = 0; i < node.childNodes.length; i++) { - descendants.push(node.childNodes[i]); - descendants = descendants.concat(getDescendants(node.childNodes[i])); + var stop = nextNodeDescendants(node); + while ((node = nextNode(node)) + && node != stop) { + descendants.push(node); } return descendants; }