mbostock/d3 — Issue #351: Hierarchy visitor pattern.
Author: mbostock
Created: 2011-10-23 21:58:39+00:00
State: open
Labels: req

Related to #317: having code for visiting each node in a hierarchy might be nice. We have that code internally, and it seems like we could expose it. Protovis had [visitAfter](http://mbostock.github.com/protovis/jsdoc/symbols/pv.Dom.Node.html#visitAfter) and visitBefore methods. D3 doesn't require that hierarchy nodes implement any particular interface (for example, they can be loaded from static JSON files), so we'd probably want a method signature like this:

```javascript
hierarchy.visitAfter(node, function)
```

There's no reason for this to be bound to a specific hierarchy layout instance, but making it a static method is more verbose. We took a similar approach with links.