packages/heml-styles/src/plugins/postcss-element-expander/tagAliasSelectors.js
function targetsElementPseudo (element, selector) {
  const selectors = simpleSelectorParser.process(selector).res

  return selectors.filter((selector) => {
    let selectorNodes = selector.nodes.concat([]).reverse() // clone the array

    for (const node of selectorNodes) {
      if (node.type === 'cominator') { break }

      if (node.type === 'pseudo' && node.value.replace(/::?/, '') in element.pseudos) {
        return true
      }

      if (node.type === 'tag' && node.value === element.tag) { break }
    }

    return false
  }).length > 0
}
function targetsElementPseudo (element, selector) {
  const selectors = simpleSelectorParser.process(selector).res

  return selectors.filter((selector) => {
    let selectorNodes = selector.nodes.concat([]).reverse() // clone the array

    for (const node of selectorNodes) {
      if (node.type === 'cominator') { break }

      if (node.type === 'pseudo' && node.value.replace(/::?/, '') in element.pseudos) {
        return true
      }

      if (node.type === 'tag' && node.value === element.tag) { break }
    }

    return false
  }).length > 0
}
function targetsElementPseudo ( element , selector ) { const selectors = simpleSelectorParser . process ( selector ) . res return selectors . filter ( ( selector ) => { let selectorNodes = selector . nodes . concat ( [ ] ) . reverse ( ) // clone the array for ( const node of selectorNodes ) { if ( node . type === 'cominator' ) { break } if ( node . type === 'pseudo' && node . value . replace ( / ::? / , '' ) in element . pseudos ) { return true } if ( node . type === 'tag' && node . value === element . tag ) { break } } return false } ) . length > 0 }
find all selectors that target the give element
@param  {Object} element  the element definition
@param  {String} selector the selector
@return {Array}           the matched selectors
find all selectors that target the give element