Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/utils/src/dom/methods/getCSSVariableByRegex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ export default function getCSSVariableByRegex(variableRegex: RegExp): { name: st
for (const sheet of document?.styleSheets) {
try {
for (const rule of sheet?.cssRules) {
for (const property of (rule as CSSStyleRule)?.style) {
if (variableRegex.test(property)) {
return { name: property, value: (rule as CSSStyleRule).style.getPropertyValue(property).trim() };
if ('style' in rule) {
for (const property of (rule as CSSStyleRule).style) {
if (variableRegex.test(property)) {
return { name: property, value: (rule as CSSStyleRule).style.getPropertyValue(property).trim() };
}
}
}
}
Expand Down