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

Events.removeEventListener fails when no events are registered. #1631

Closed
tjoekbezoer opened this issue Apr 29, 2013 · 0 comments
Closed

Events.removeEventListener fails when no events are registered. #1631

tjoekbezoer opened this issue Apr 29, 2013 · 0 comments

Comments

@tjoekbezoer
Copy link
Contributor

Situation
Consider the following code:

var line = new L.Polyline(points, {clickable: false});

Now if you call line.removeEventListener('click') without manually adding a listener, it will throw an error.

Problem
This seems to be caused by the fact that the this['_leaflet_events'] will only exist if addEventListener is called at least once. removeEventListener however does not check the existence of the property.

Solution
Add the check :) See my pull request.

mourner added a commit that referenced this issue Apr 29, 2013
Issue #1631: Fixed a bug on removeEventListener
@mourner mourner closed this as completed Apr 29, 2013
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