{"version":3,"file":"elementMatchesRule.mjs","names":[],"sources":["../../../src/parser/elementMatchesRule.ts"],"sourcesContent":["import { selectorMatches } from './selectorMatches';\nimport { doesSomeParentMatch } from './doesSomeParentMatch';\n\n/**\n * @private\n */\n\nexport function elementMatchesRule(\n  element: HTMLElement | SVGElement,\n  selectors: string[],\n) {\n  let parentMatching = true;\n  // start from rightmost selector.\n  const firstMatching = selectorMatches(element, selectors.pop()!);\n  if (firstMatching && selectors.length) {\n    parentMatching = doesSomeParentMatch(element, selectors);\n  }\n  return firstMatching && parentMatching && selectors.length === 0;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,mBACd,SACA,WACA;CACA,IAAI,iBAAiB;CAErB,MAAM,gBAAgB,gBAAgB,SAAS,UAAU,KAAK,CAAE;AAChE,KAAI,iBAAiB,UAAU,OAC7B,kBAAiB,oBAAoB,SAAS,UAAU;AAE1D,QAAO,iBAAiB,kBAAkB,UAAU,WAAW"}