-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing global document references #1482
Removing global document references #1482
Conversation
🦋 Changeset detectedLatest commit: 6869ab4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Hi Alfie, thanks for your PR! Can you explain if there was a situation where the use of the global |
I was running the rebuild outside of a dom environment using jsdom so any references to the global document would fail. |
…ce of the passed in `doc`
Thank you. |
I also explored a test on the rebuild side, but don't think it's worth adding; |
Update patch text with my best understanding
fix for options `recordCanvas: true`: * replace document.createElement with doc.createElement in rrweb-snapshot code * Eoghan: add a regression test to prevent future accidental use of `document` instead of `doc`. This test can be excised if a new feature can only be run in the browser and not in the jsdom environment
fix for options `recordCanvas: true`: * replace document.createElement with doc.createElement in rrweb-snapshot code * Eoghan: add a regression test to prevent future accidental use of `document` instead of `doc`. This test can be excised if a new feature can only be run in the browser and not in the jsdom environment
fix for options `recordCanvas: true`: * replace document.createElement with doc.createElement in rrweb-snapshot code * Eoghan: add a regression test to prevent future accidental use of `document` instead of `doc`. This test can be excised if a new feature can only be run in the browser and not in the jsdom environment
fix for options `recordCanvas: true`: * replace document.createElement with doc.createElement in rrweb-snapshot code * Eoghan: add a regression test to prevent future accidental use of `document` instead of `doc`. This test can be excised if a new feature can only be run in the browser and not in the jsdom environment
fix for options `recordCanvas: true`: * replace document.createElement with doc.createElement in rrweb-snapshot code * Eoghan: add a regression test to prevent future accidental use of `document` instead of `doc`. This test can be excised if a new feature can only be run in the browser and not in the jsdom environment
In the rrweb-snapshot package, there are a few references to a global document object instead of using the doc parameter.
This pr moves them to the doc parameter inline with the rest of the package.
There's room for improving the typescript support to throw an error when accessing the document element but I wasn't able to figure out a clean way to achieve this.