MCPcopy
hub / github.com/vitejs/vite / getCssRuleBg

Function getCssRuleBg

playground/test-utils.ts:133–145  ·  view source on GitHub ↗
(selector: string)

Source from the content-addressed store, hash-verified

131 * `getBg` returns the resolved value, which has the hostname and port prepended due to `computedStyle` call.
132 */
133export async function getCssRuleBg(selector: string): Promise<string> {
134 return page.evaluate((sel) => {
135 for (const sheet of document.styleSheets) {
136 try {
137 for (const rule of sheet.cssRules) {
138 if (rule instanceof CSSStyleRule && rule.selectorText === sel) {
139 return rule.style.backgroundImage
140 }
141 }
142 } catch (_e) {}
143 }
144 }, selector)
145}
146
147export async function getBgColor(
148 el: string | ElementHandle | Locator,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected