Skip to content

Instantly share code, notes, and snippets.

@nmtitov
Created November 30, 2012 18:49
Show Gist options
  • Select an option

  • Save nmtitov/4177696 to your computer and use it in GitHub Desktop.

Select an option

Save nmtitov/4177696 to your computer and use it in GitHub Desktop.

Revisions

  1. nt9 created this gist Nov 30, 2012.
    13 changes: 13 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    var $es = [];
    var findLeaves = function(i, $root) {
    console.log($root);
    $children = $root.children();
    if($children.length > 0) {
    $children.each(findLeaves);
    }
    else {
    $es.push($root);
    }
    }
    var rr = jQuery('#section-summary');
    findLeaves(0, rr);