Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event listener function overloads are too brittle, error if evt is undefined #244

Open
jpike88 opened this issue Jan 24, 2022 · 1 comment

Comments

@jpike88
Copy link

jpike88 commented Jan 24, 2022

The document.addEventListener, document.removeEventListener, window.addEventListener, window.removeEventListener overloads in cordova.js error if the evt variable is undefined. While this is something that also be fixed upstream in the relevant calling code, these functions should not be erroring as that is not the behaviour of what they are overloading.

window.addEventListener(undefined, () => {})

In cordova.js, the above would cause an error.
In safari/chrome console, no error is triggered.

I have create a PR to address this.
#245

Related:
ionic-team/capacitor#4178
mapbox/mapbox-gl-js#11433

@alexculea
Copy link

Adding to this, passing an Event instance instead of a string will also throw an exception when trying to get it converted to a lower case string as for example here:

var e = evt.toLowerCase();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants