From f37380969a5813b85448974ade5736de54586575 Mon Sep 17 00:00:00 2001 From: "Evan W. Patton" Date: Tue, 13 Jun 2023 12:30:45 -0400 Subject: [PATCH] fix: Allow for unattached elements during inject call (#7149) Change-Id: I616cb30b8a3292b3be9f58536d7bfb9444e529d4 --- core/inject.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/inject.ts b/core/inject.ts index 52336eefa..be9891e4c 100644 --- a/core/inject.ts +++ b/core/inject.ts @@ -46,7 +46,10 @@ export function inject( containerElement = container; } // Verify that the container is in document. - if (!document.contains(containerElement)) { + if ( + !document.contains(containerElement) && + document !== containerElement?.ownerDocument + ) { throw Error('Error: container is not in current document'); } const options = new Options(opt_options || ({} as BlocklyOptions));