src/model/css-select-adapter.js
/**
 * Takes an array of nodes, and removes any duplicates, as well as any
 * nodes whose ancestors are also in the array.
 */
Takes an array of nodes, and removes any duplicates, as well as any
nodes whose ancestors are also in the array.
Takes an array of nodes and removes any duplicates as well as any nodes whose ancestors are also in the array .
function removeSubsets(nodes) {
  const deduped = new Set(nodes);
  deduped.forEach((node) => {
    let ancestor = node.parent;
    while (ancestor) {
      if (deduped.has(ancestor)) {
        deduped.delete(node);
        return;
      }
      ancestor = ancestor.parent;
    }
  });
  return Array.from(deduped);
}
function removeSubsets ( nodes ) { const deduped = new Set ( nodes ) ; deduped . forEach ( ( node ) => { let ancestor = node . parent ; while ( ancestor ) { if ( deduped . has ( ancestor ) ) { deduped . delete ( node ) ; return ; } ancestor = ancestor . parent ; } } ) ; return Array . from ( deduped ) ; }
Takes an array of nodes, and removes any duplicates, as well as any
 nodes whose ancestors are also in the array.
Takes an array of nodes and removes any duplicates as well as any nodes whose ancestors are also in the array .