- Fix router import path in main.js - Handle Django REST Framework pagination format in API calls - Add getTemplates function to project API - Restart frontend development server
20 lines
548 B
TypeScript
20 lines
548 B
TypeScript
import { selectorMatches } from './selectorMatches';
|
|
import { doesSomeParentMatch } from './doesSomeParentMatch';
|
|
|
|
/**
|
|
* @private
|
|
*/
|
|
|
|
export function elementMatchesRule(
|
|
element: HTMLElement | SVGElement,
|
|
selectors: string[],
|
|
) {
|
|
let parentMatching = true;
|
|
// start from rightmost selector.
|
|
const firstMatching = selectorMatches(element, selectors.pop()!);
|
|
if (firstMatching && selectors.length) {
|
|
parentMatching = doesSomeParentMatch(element, selectors);
|
|
}
|
|
return firstMatching && parentMatching && selectors.length === 0;
|
|
}
|