cpettitt/dagre-d3 — pull request #80 by brianchin (2014-08-22 21:36:49+00:00)
Title: Support DOM Element objects and DOM Element generating functions as node labels.

As of right now, each re-rendering of a graph requires a reparsing of each node label from scratch, for each HTML label. In the case of a more complicated application, which may have elements that are already bound and configured outside of the graph generation logic, having to create HTML that will recreate it is not a possibility. Other solutions, such as adding a div which you can add the element to later, is infeasable, as the rendering algorithm takes into account the size of the element.

This change allows the label property (as used in second argument of addNode) to be an object or a function, in addition to a string. If it is an object, it is added as a foreign object element into the svg. If it is a function, it is called to generate an appropriate element. This function call is performed by d3's insert() method, so it will share its semantics.