function removeAttached(elements) {

  var ids = groupBy(elements, 'id');

  return filter(elements, function(element) {
    while (element) {

      // host in selection
      if (element.host && ids[element.host.id]) {
        return false;
      }

      element = element.parent;
    }

    return true;
  });
}
/**
 * Return a filtered list of elements that do not
 * contain attached elements with hosts being part
 * of the selection.
 *
 * @param  {Array<djs.model.Base>} elements
 *
 * @return {Array<djs.model.Base>} filtered
 */
Return a filtered list of elements that do not
contain attached elements with hosts being part
of the selection.

@param  {Array} elements

@return {Array} filtered
Return a filtered list of elements that do not contain attached elements with hosts being part of the selection . @param { Array } elements @return { Array } filtered
function removeAttached(elements) {
  var ids = groupBy(elements, 'id');
  return filter(elements, function(element) {
    while (element) {
      if (element.host && ids[element.host.id]) {
        return false;
      }
      element = element.parent;
    }
    return true;
  });
}
function removeAttached ( elements ) { var ids = groupBy ( elements , 'id' ) ; return filter ( elements , function ( element ) { while ( element ) { if ( element . host && ids [ element . host . id ] ) { return false ; } element = element . parent ; } return true ; } ) ; }
Return a filtered list of elements that do not
 contain attached elements with hosts being part
 of the selection.
Return a filtered list of elements that do not contain attached elements with hosts being part of the selection .
// host in selection