MCPcopy Index your code
hub / github.com/darkreader/darkreader / clearEmptyRules

Function clearEmptyRules

src/utils/css-text/format-css.ts:60–74  ·  view source on GitHub ↗
(rules: Array<ParsedAtRule | ParsedStyleRule>)

Source from the content-addressed store, hash-verified

58}
59
60function clearEmptyRules(rules: Array<ParsedAtRule | ParsedStyleRule>) {
61 for (let i = rules.length - 1; i >= 0; i--) {
62 const rule = rules[i];
63 if (isParsedStyleRule(rule)) {
64 if (rule.declarations.length === 0) {
65 rules.splice(i, 1);
66 }
67 } else {
68 clearEmptyRules(rule.rules);
69 if (rule.rules.length === 0) {
70 rules.splice(i, 1);
71 }
72 }
73 }
74}

Callers 1

formatParsedCSSFunction · 0.85

Calls 1

isParsedStyleRuleFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…