function fixTargetRef(event) {

    var context = event.context,
        connection = context.connection,
        connectionBo = connection.businessObject,
        target = connection.target,
        targetBo = target && target.businessObject,
        newTarget = context.newTarget,
        newTargetBo = newTarget && newTarget.businessObject,
        oldTarget = context.oldTarget || context.target,
        oldTargetBo = oldTarget && oldTarget.businessObject;

    var dataAssociation = connection.businessObject,
        targetRefProp;

    if (oldTargetBo && oldTargetBo !== targetBo) {
      cleanupTargetRef(oldTargetBo, connectionBo);
    }

    if (newTargetBo && newTargetBo !== targetBo) {
      cleanupTargetRef(newTargetBo, connectionBo);
    }

    if (targetBo) {
      targetRefProp = getTargetRef(targetBo, true);
      dataAssociation.targetRef = targetRefProp;
    } else {
      dataAssociation.targetRef = null;
    }
  }
/**
   * Make sure targetRef is set to a valid property or
   * `null` if the connection is detached.
   *
   * @param {Event} event
   */
Make sure targetRef is set to a valid property or
`null` if the connection is detached.

@param {Event} event
Make sure targetRef is set to a valid property or ` null ` if the connection is detached . @param { Event } event
function fixTargetRef(event) {
    var context = event.context,
        connection = context.connection,
        connectionBo = connection.businessObject,
        target = connection.target,
        targetBo = target && target.businessObject,
        newTarget = context.newTarget,
        newTargetBo = newTarget && newTarget.businessObject,
        oldTarget = context.oldTarget || context.target,
        oldTargetBo = oldTarget && oldTarget.businessObject;
    var dataAssociation = connection.businessObject,
        targetRefProp;
    if (oldTargetBo && oldTargetBo !== targetBo) {
      cleanupTargetRef(oldTargetBo, connectionBo);
    }
    if (newTargetBo && newTargetBo !== targetBo) {
      cleanupTargetRef(newTargetBo, connectionBo);
    }
    if (targetBo) {
      targetRefProp = getTargetRef(targetBo, true);
      dataAssociation.targetRef = targetRefProp;
    } else {
      dataAssociation.targetRef = null;
    }
  }
function fixTargetRef ( event ) { var context = event . context , connection = context . connection , connectionBo = connection . businessObject , target = connection . target , targetBo = target && target . businessObject , newTarget = context . newTarget , newTargetBo = newTarget && newTarget . businessObject , oldTarget = context . oldTarget || context . target , oldTargetBo = oldTarget && oldTarget . businessObject ; var dataAssociation = connection . businessObject , targetRefProp ; if ( oldTargetBo && oldTargetBo !== targetBo ) { cleanupTargetRef ( oldTargetBo , connectionBo ) ; } if ( newTargetBo && newTargetBo !== targetBo ) { cleanupTargetRef ( newTargetBo , connectionBo ) ; } if ( targetBo ) { targetRefProp = getTargetRef ( targetBo , true ) ; dataAssociation . targetRef = targetRefProp ; } else { dataAssociation . targetRef = null ; } }
Make sure targetRef is set to a valid property or
 `null` if the connection is detached.
Make sure targetRef is set to a valid property or ` null ` if the connection is detached .