-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Describe the bug
When using withPreventDefault
in a standard/template Rollup + Svelte project, I get the following error: Uncaught TypeError: Illegal invocation
It seems to be pointing to this line in callIfExists
, which the compiler spits out as this:
return (_a = event === null || event === void 0 ? void 0 : event[method]) === null || _a === void 0 ? void 0 : _a();
Where invoking _a()
seems to be causing the bug.
To Reproduce
Steps to reproduce the behavior:
- Clone the svelte template repo.
yarn add browser-event-utils@next
- Wrap an event handler with
withPreventDefault
:
<script>
import { withPreventDefault } from 'browser-event-utils';
const handleDrop = withPreventDefault(() => { //... });
</script>
<div on:drop={handleDrop}>
Drop here!
</div>
- Invoke the event, you should see the error.
Expected behavior
It should just call the expected method, no errors.
Versions (please complete the following information):
browser-event-utils
Version: [eg:v3.0.0-beta.5
]- Browser & Version:
Google Chrome 83.0.4103.106
- Framework version (if applicable) [eg:
svelte@3.23.2
] - (Optionally) NodeJS Version:
v12.16.3
Additional context or comments
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
No labels