function cleanDraggingSelection(oldConnection, newConnection) {
    var context = dragging.context(),
        previousSelection = context && context.payload.previousSelection,
        index;

    // do nothing if not dragging or no selection was present
    if (!previousSelection || !previousSelection.length) {
      return;
    }

    index = previousSelection.indexOf(oldConnection);

    if (index === -1) {
      return;
    }

    previousSelection.splice(index, 1, newConnection);
  }
// monkey-patch selection saved in dragging in order to re-select it when operation is finished
monkey-patch selection saved in dragging in order to re-select it when operation is finished
monkey - patch selection saved in dragging in order to re - select it when operation is finished
function cleanDraggingSelection(oldConnection, newConnection) {
    var context = dragging.context(),
        previousSelection = context && context.payload.previousSelection,
        index;
    if (!previousSelection || !previousSelection.length) {
      return;
    }
    index = previousSelection.indexOf(oldConnection);
    if (index === -1) {
      return;
    }
    previousSelection.splice(index, 1, newConnection);
  }
function cleanDraggingSelection ( oldConnection , newConnection ) { var context = dragging . context ( ) , previousSelection = context && context . payload . previousSelection , index ; if ( ! previousSelection || ! previousSelection . length ) { return ; } index = previousSelection . indexOf ( oldConnection ) ; if ( index === - 1 ) { return ; } previousSelection . splice ( index , 1 , newConnection ) ; }
monkey-patch selection saved in dragging in order to re-select it when operation is finished
monkey - patch selection saved in dragging in order to re - select it when operation is finished
// do nothing if not dragging or no selection was present