Accept function for selection append and insert.

Like selection.select, selection.append and selection.insert can now accept a function which returns a node. This facilitates appending or inserting elements whose name is computed from data, or appending elements that were created previously (such as removed elements or elements from a pool).

There has been [much discussion](https://github.com/mbostock/d3/pull/732#issuecomment-7436280) regarding whether the function should return the name of the element or the element itself. Returning a name is less work for the caller, but only supports creating new elements. Returning a name is more consistent with how D3 defines attribute values, but D3 does not allow attribute names to be specified as functions. So, it seemed better to opt for consistency with selection.select and selection.selectAll, which accept functions that return elements. Of course, you can still pass a function to selection.select, selection.selectAll or selection.each to accomplish the same thing, but using selection.append is more intuitive.

Related #4 #311 #724 #732 #734 #961 #1031 #1271.