lib/features/attach-support/AttachSupport.js
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;
  });
}
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;
  });
}
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 .