From 92cd340234cf301277e76b346edc087f345ec4f1 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 12 Apr 2023 09:50:59 -0500 Subject: [PATCH] fix: ensure snippet works in es5 --- src/lib/main/snippet.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib/main/snippet.ts b/src/lib/main/snippet.ts index 1297f830..ecf0781f 100644 --- a/src/lib/main/snippet.ts +++ b/src/lib/main/snippet.ts @@ -82,13 +82,8 @@ export function snippet( libPath + 'partytown-' + (isAtomics ? 'atomics.js?v=_VERSION_' : 'sandbox-sw.html?' + Date.now()); - let sandboxParent = doc.querySelector(config?.sandboxParent ?? 'body'); - if(!sandboxParent) { - console.warn(`Partytown sandboxParent element was not found on the page!`); - sandboxParent = doc.body - } - - sandboxParent.appendChild(sandbox); + + doc.querySelector(config!.sandboxParent || 'body')!.appendChild(sandbox); } function fallback(i?: number, script?: HTMLScriptElement) {