From b1ecabc953a1596b2ed10e99b832aca3b7e90871 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Fri, 13 Aug 2021 20:40:24 +0200 Subject: [PATCH] [fix] check for parent_component before accessing root --- src/runtime/internal/Component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runtime/internal/Component.ts b/src/runtime/internal/Component.ts index e706928af305..37763ddba0a2 100644 --- a/src/runtime/internal/Component.ts +++ b/src/runtime/internal/Component.ts @@ -38,7 +38,7 @@ interface T$$ { on_destroy: any[]; skip_bound: boolean; on_disconnect: any[]; - root:Element|ShadowRoot + root:null|Element|ShadowRoot } export function bind(component, name, callback) { @@ -130,10 +130,10 @@ export function init(component, options, instance, create_fragment, not_equal, p callbacks: blank_object(), dirty, skip_bound: false, - root: options.target || parent_component.$$.root + root: options.target || (parent_component ? parent_component.$$.root : null) }; - append_styles && append_styles($$.root); + append_styles && $$.root && append_styles($$.root); let ready = false;