WickyNilliams / enquire.js

Awesome Media Queries in JavaScript
http://wicky.nillia.ms/enquire.js/
MIT License
3.63k stars 269 forks source link

Fix unregister issue #154

Closed rosszurowski closed 7 years ago

rosszurowski commented 7 years ago

This PR adds a fix for #124. A minimal test case for this issue can be found here.

The fix, taken from @intrasoft-eu's solution, uses mql.currentTarget if it's available:

Whenever an unregister is happening, the debugger throws "undefined not a function", because 'mql' is not a MediaQueryList but a MediaQueryListEvent, which doesn't have the removeListener method, and thus the error is thrown.

More details can be found in the issue thread.

WickyNilliams commented 7 years ago

Closed as i fixed independently (didn't want to commit the dist files from here, or wait for response). Thanks for making the PR, really appreciate it! Sorry for being a terrible maintainer

rosszurowski commented 7 years ago

Haha, it's all good. Thanks for fixing!