MCPcopy
hub / github.com/darkreader/darkreader / getSheetScope

Function getSheetScope

src/inject/dynamic-theme/style-scope.ts:7–23  ·  view source on GitHub ↗
(sheet: CSSStyleSheet)

Source from the content-addressed store, hash-verified

5}
6
7export function getSheetScope(sheet: CSSStyleSheet): Document | ShadowRoot | null {
8 if (!sheet.ownerNode) {
9 return null;
10 }
11 if (sheetsScopes.has(sheet)) {
12 return sheetsScopes.get(sheet)!;
13 }
14 let node: Node | null = sheet.ownerNode;
15 while (node) {
16 if (node instanceof ShadowRoot || node instanceof Document) {
17 defineSheetScope(sheet, node);
18 return node;
19 }
20 node = node.parentNode;
21 }
22 return null;
23}

Callers 1

getURLModifierFunction · 0.90

Calls 3

defineSheetScopeFunction · 0.85
hasMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected