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.

[9.4.0] ReferenceError: MouseEvent is not defined

See original GitHub issue

Getting this error with the newly released 9.4.0.

ReferenceError: MouseEvent is not defined

See https://circleci.com/gh/tleunen/react-clickdrag/88

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Sebmastercommented, Jul 2, 2016
jsdom = require('jsdom');

const doc = jsdom.jsdom('<!doctype html><html><body></body></html>', {
  url: 'http://test/'
});
const window = doc.defaultView;

console.log(window.MouseEvent)

=>

me@host:~/jsdom/test$ node test
[Function: MouseEvent]

Looks fine to me. Your code is wrong, it was probably broken by 8978de23642f7276f20640f911dc1eebfc3f1d05. But if you check Object.keys(window) in your browser, you’ll see that MouseEvent is not in there.

0reactions
tleunencommented, Jul 7, 2016

Might be related but since 9.4.0, it seems I’m not able to use sinon to restore a spy on document.addEventListener

The second time I create the spy, I get this error: TypeError: Attempted to wrap addEventListener which is already wrapped, but I’m 100% sure the spy is restored. (document.addEventListener.restore();)

Any idea?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: MouseEvent is not defined - Stack Overflow
1) Make sure the right Components are being imported, and verify if MouseEvent is defined · 2) Verify if all the components are...
Read more >
How to Fix ReferenceError: Event is Not Defined in JavaScript
The Javascript ReferenceError occurs when referencing a variable that does not exist or has not yet been initialized in the current scope.
Read more >
MouseEvent is not defined-angular.js - appsloveworld
[Solved]-Angular Universal error ReferenceError: MouseEvent is not defined-angular.js ... Client side code like Document , Window , localstorage , MouseEvent etc ...
Read more >
Changelog.md - jest-environment-jsdom-fourteen - GitLab
JSDOM.fragment() now creates fragments whose document has no browsing ... Fixed all events fired by jsdom to have isTrusted set to true ....
Read more >
@forbeslindesay/jsdom | Yarn - Package Manager
9.4.0. Added the DOMParser API. It is spec-compliant, including producing ... Fix: Using querySelector :not() throws a ReferenceError (Felix Gnass) ...
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