import “selection”; import “enter”;

d3_selection_enterPrototype.insert = function(name, before) {

if (arguments.length < 2) before = d3_selection_enterInsertBefore(this);
return d3_selectionPrototype.insert.call(this, name, before);

};

function d3_selection_enterInsertBefore(enter) {

var i0, j0;
return function(d, i, j) {
  var group = enter[j].update,
      n = group.length,
      node;
  if (j != j0) j0 = j, i0 = 0;
  if (i >= i0) i0 = i + 1;
  while (!(node = group[i0]) && ++i0 < n);
  return node;
};

}