examples/browser/tree/tree.js
function click(d) {
      if (d.children) {
        d._children = d.children;
        d.children = null;
      } else {
        d.children = d._children;
        d._children = null;
      }
      update(d);
    }
function click(d) {
      if (d.children) {
        d._children = d.children;
        d.children = null;
      } else {
        d.children = d._children;
        d._children = null;
      }
      update(d);
    }
function click ( d ) { if ( d . children ) { d . _children = d . children ; d . children = null ; } else { d . children = d . _children ; d . _children = null ; } update ( d ) ; }
Toggle children on click.
Toggle children on click .