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.

Support for CustomEvent (and the general plan for Level 3 support)

See original GitHub issue

Hi,

I noticed jsdom doesn’t support Level 3 custom events, so the following code crashes:

var tap = document.createEvent('CustomEvent');
tap.initCustomEvent('tap', true, true, {});

It would be relatively trivial to add a basic empty implementation in the level 2 folder (baaaaad), but I wouldn’t know where to start with Level 3 (everything is commented-out). What’s the plan in that area?

On a related topic, the new standard seems to be using event constructors instead of initCustomEvent. Does that fit into Level 4 support?

var event = new Event('focus', {bubbles:false,cancelable:true});
document.querySelector('input').dispatchEvent(event);

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
treshugartcommented, Sep 12, 2015

@rprieto I found that doing something like the following worked for my purposes:

function createCustomEvent (name, opts = {}) {
  let e = document.createEvent('HTMLEvents');
  e.detail = opts.detail;
  e.initEvent(name, opts.bubbles, opts.cancelable);
  return e;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

CustomEvent | Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
Create a Custom Event - Salesforce Help
Select Routes & Schedule, and then click Custom Event. In the Create Custom Event Config window, select your custom object from the list,...
Read more >
Custom Variable and Event Reporting in Classic Google ...
This event carries the custom variables into GA, so the general page view tracking is unaffected by the Demandbase integration. This special ...
Read more >
Tracked Custom Events - Insightly Help Center
Under the Feature Settings section, select Tracked Custom Events. From the Tracked Custom Events page, existing custom events will display in the list...
Read more >
Custom Events - Teachstone
Support engagement with features such as live chat and recording access; Connect participants ... Bring a Teachstone Custom Event to Your Program Today....
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