Skip to content

Commit

Permalink
fix: ensure snippet works in es5
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Apr 12, 2023
1 parent da44d00 commit 92cd340
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/lib/main/snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

1 comment on commit 92cd340

@vercel
Copy link

@vercel vercel bot commented on 92cd340 Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.