(sheet: CSSStyleSheet)
| 5 | } |
| 6 | |
| 7 | export 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 | } |
no test coverage detected