diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 98adc99b59..2aef1c7f28 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -151,7 +151,7 @@ export function get_root_for_style(node: Node): ShadowRoot | Document { if ((root as ShadowRoot).host) { return root as ShadowRoot; } - return document; + return node.ownerDocument; } export function append_empty_stylesheet(node: Node) {