Skip to content

Commit

Permalink
createEvent: Only run dataTransfer workarounds in json environments
Browse files Browse the repository at this point in the history
  • Loading branch information
nifgraup committed Jan 15, 2025
1 parent a86c54c commit 6f8117e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ function createEvent(
// DataTransfer is not supported in jsdom: https://github.com/jsdom/jsdom/issues/1568
const dataTransferProperties = ['dataTransfer', 'clipboardData']
dataTransferProperties.forEach(dataTransferKey => {
if (event[dataTransferKey]) {
// not a jsdom environment, workaround not needed
return;
}

const dataTransferValue = eventInit[dataTransferKey]

if (typeof dataTransferValue === 'object') {
Expand Down

0 comments on commit 6f8117e

Please sign in to comment.