Skip to content

Commit

Permalink
createEvent: Only run dataTransfer workarounds in jsdom environments
Browse files Browse the repository at this point in the history
  • Loading branch information
nifgraup committed Jan 15, 2025
1 parent 31b37f4 commit db9cd6c
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 db9cd6c

Please sign in to comment.