Major Bug - Always overrides native CustomEvent across all browsers
See original GitHub issueThe polyfill test always fails and as a result the browser never uses the native implementation even when it is available.
The issue is with this code: https://github.com/krambuhl/custom-event-polyfill/blob/71749f01e4e8e3e7e52ffb646bb50c4f78f87961/custom-event-polyfill.js#L7-L15
Instead of
var ce = new window.CustomEvent('test');
is should be
var ce = new window.CustomEvent('test', {cancelable: true});
otherwise ce.defaultPrevented
always equals to false
and the error is always thrown.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Should web pages be restricted from being able to override ...
For the purpose of this bug, the answer is yes, web pages should be able to override all keyboard shortcuts, but only if...
Read more >TypeScript doesn't allow event : CustomEvent in ... - GitHub
I'm using Visual Studio Code - Insiders v 1.29.0-insider In my TypeScript project, I'm trying to write the following code: buttonEl.
Read more >Shadow DOM v1 - Self-Contained Web Components
Shadow DOM allows web developers to create compartmentalized DOM and CSS for web components.
Read more >Modify Tealeaf events in Advanced mode - Acoustic Developers
Reference value override. An event's reference value is both a variable that other events can access and a mechanism that can populate session...
Read more >Custom events in JavaScript: A complete guide
This is the behavior of most native DOM events, but for custom events, ... However, if you want to dispatch a custom event...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In the meanwhile, you can use this fork which has @andrejpavlovic and @shrpne’s changes https://www.npmjs.com/package/@playlyfe/custom-event-polyfill
PR has been merged, closing this ticket.