MCPcopy
hub / github.com/primer/react / readMedia

Function readMedia

packages/react/src/utils/testing.tsx:135–150  ·  view source on GitHub ↗
(mediaRule: CSSMediaRule)

Source from the content-addressed store, hash-verified

133 }
134
135 function readMedia(mediaRule: CSSMediaRule) {
136 const key = `@media ${mediaRule.media[0]}`
137 // const dest = computed[key] || (computed[key] = {})
138 const dest = {}
139 for (const rule of mediaRule.cssRules) {
140 if (rule instanceof CSSStyleRule) {
141 readRule(rule, dest)
142 }
143 }
144
145 // Don't add media rule to computed styles
146 // if no styles were actually applied
147 if (Object.keys(dest).length > 0) {
148 computed[key] = dest
149 }
150 }
151}
152/**
153 * This provides a layer of compatibility between the render() function from

Callers 1

getComputedStylesFunction · 0.85

Calls 1

readRuleFunction · 0.85

Tested by

no test coverage detected