question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Major Bug - Always overrides native CustomEvent across all browsers

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kumarharshcommented, May 15, 2018

In the meanwhile, you can use this fork which has @andrejpavlovic and @shrpne’s changes https://www.npmjs.com/package/@playlyfe/custom-event-polyfill

0reactions
krambuhlcommented, Jul 21, 2018

PR has been merged, closing this ticket.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found