BuilderIO / partytown

Relocate resource intensive third-party scripts off of the main thread and into a web worker. 🎉
https://partytown.builder.io
MIT License
13.05k stars 433 forks source link

[Bug] document.createRange does not work properly #273

Open itxch opened 2 years ago

itxch commented 2 years ago

Describe the bug document.createRange() methods don't work. Trying to add an element to the DOM using selectNode and createContextualFragment does not work.

The exact same code works when ran without partytown.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://empty-wave-2618.fly.dev/
  2. The text that should be visible (added by script.js) is not.

Reproduction link

Expected behavior The text "Hello there :)" should be visible on the page.

Partytown version v0.7.0 (latest at time of writing)

Additional context Issue could be that that the Range has a commonAncestorContainer that is #document rather than body which seems to be the browser default. And even when using selectNode it cant be changed.

itxch commented 2 years ago

@adamdbradley would be great to get your input/thoughts on this one