mbostock/d3 — pull request #1966 by Anmo (2014-08-06 17:44:23+00:00)
Title: Selection.parent

This will permit to append childs (siblings between them) to a element in chaining (without set a var with the parent).

Now:
var div = d3.select( 'body' ).append( 'div' );
div.append( 'p' ).text( 'I\'m a P' );
div.append( 'a' ).text( 'I\'m an A' )
.append( 'span' ).text( 'with a SPAN' );
div.append( 'span' ).text( 'I\'m just a SPAN' );

With this:
d3.select( 'body' )
.append( 'div' )
.append( 'p' ).text( 'I\'m a P' )
.parent( )
.append( 'a' ).text( 'I\'m an A' )
.append( 'span' ).text( 'with a SPAN' )
.parent( )
.parent( )
.append( 'span' ).text( 'I\'m just a SPAN' );