MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / mayMatch

Method mayMatch

packages/core/ui/styling/css-selector.ts:720–741  ·  view source on GitHub ↗
(node: Node)

Source from the content-addressed store, hash-verified

718 }
719
720 public mayMatch(node: Node): boolean {
721 return this.selectors.every((sel, i) => {
722 if (i === 0) {
723 return node && sel.mayMatch(node);
724 }
725
726 if (sel.combinator === Combinator.adjacent) {
727 node = getNodePreviousDirectSibling(node);
728 return node && sel.mayMatch(node);
729 }
730
731 // Sibling combinator
732 let isMatching: boolean = false;
733
734 eachNodePreviousGeneralSibling(node, (sibling) => {
735 isMatching = sel.mayMatch(sibling);
736 return !isMatching;
737 });
738
739 return isMatching;
740 });
741 }
742
743 public trackChanges(node: Node, map: ChangeAccumulator): void {
744 this.selectors.forEach((sel, i) => {

Callers

nothing calls this directly

Calls 4

everyMethod · 0.80
mayMatchMethod · 0.45

Tested by

no test coverage detected