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

Function getStyleRuleHash

src/inject/dynamic-theme/stylesheet-modifier.ts:49–58  ·  view source on GitHub ↗
(rule: CSSStyleRule)

Source from the content-addressed store, hash-verified

47 let renderId = 0;
48
49 function getStyleRuleHash(rule: CSSStyleRule) {
50 let cssText = rule.cssText;
51 if (isMediaRule(rule.parentRule)) {
52 cssText = `${rule.parentRule.media.mediaText} { ${cssText} }`;
53 }
54 if (isLayerRule(rule.parentRule)) {
55 cssText = `${rule.parentRule.name} { ${cssText} }`;
56 }
57 return getHashCode(cssText);
58 }
59
60 const rulesTextCache = new Set<number>();
61 const rulesModCache = new Map<number, ModifiableCSSRule>();

Callers 1

modifySheetFunction · 0.85

Calls 3

isMediaRuleFunction · 0.90
isLayerRuleFunction · 0.90
getHashCodeFunction · 0.90

Tested by

no test coverage detected