Skip to content
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

fix: work around shadowed globals #892

Merged
merged 2 commits into from
Mar 31, 2022
Merged

fix: work around shadowed globals #892

merged 2 commits into from
Mar 31, 2022

Conversation

ph-fritsche
Copy link
Member

What:

Remove direct references to global constructors for DOM(-related) implementation.

Why:

Codesandbox environment has shadowed global constructors which break instanceof checks.
See codesandbox/codesandbox-client#6580

How:

Get the window from the elements/document.
Get the constructor from that window.

Checklist:

  • Tests
  • Ready to be merged

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 31, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 983b930:

Sandbox Source
userEvent-dom Configuration
userEvent-react Configuration

@codecov
Copy link

codecov bot commented Mar 31, 2022

Codecov Report

Merging #892 (983b930) into main (810c0d8) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #892   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           84        85    +1     
  Lines         1758      1774   +16     
  Branches       656       657    +1     
=========================================
+ Hits          1758      1774   +16     
Impacted Files Coverage Δ
src/clipboard/paste.ts 100.00% <100.00%> (ø)
src/event/behavior/click.ts 100.00% <100.00%> (ø)
src/pointer/pointerPress.ts 100.00% <100.00%> (ø)
src/utils/dataTransfer/Blob.ts 100.00% <100.00%> (ø)
src/utils/dataTransfer/Clipboard.ts 100.00% <100.00%> (ø)
src/utils/dataTransfer/DataTransfer.ts 100.00% <100.00%> (ø)
src/utils/focus/copySelection.ts 100.00% <100.00%> (ø)
src/utils/misc/getWindow.ts 100.00% <100.00%> (ø)
src/utils/misc/isVisible.ts 100.00% <100.00%> (ø)
src/utils/pointer/cssPointerEvents.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 810c0d8...983b930. Read the comment docs.

@ph-fritsche
Copy link
Member Author

@ph-fritsche ph-fritsche merged commit 126d2e7 into main Mar 31, 2022
@ph-fritsche ph-fritsche deleted the fix-codesandbox branch March 31, 2022 15:29
@github-actions
Copy link

🎉 This PR is included in version 14.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant