MCPcopy Index your code
hub / github.com/primer/react / matchesSafe

Function matchesSafe

packages/react/src/utils/testing.tsx:112–121  ·  view source on GitHub ↗
(node: HTMLDivElement, selector: string)

Source from the content-addressed store, hash-verified

110 return computed
111
112 function matchesSafe(node: HTMLDivElement, selector: string) {
113 if (!selector) {
114 return false
115 }
116 try {
117 return node.matches(selector)
118 } catch (error) {
119 return false
120 }
121 }
122
123 function readRule(rule: CSSStyleRule, dest: ComputedStyles) {
124 if (matchesSafe(div, rule.selectorText)) {

Callers 1

readRuleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected