-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Fix mouseout bubbling while initial target was not listening (fix #3648) #3650
Conversation
Fix mouseout bubbling while initial target was not listening (fix #3648)
Awesome! |
I think this fix has regressed. (Too bad a unit test wasn't possible…) If a |
Would be very nice, thanks! You can use http://playground-leaflet.rhcloud.com/ for that :) |
For the record, it's now possible to set |
Related: Leaflet/prosthetic-hand#9 |
Here you go: http://playground-leaflet.rhcloud.com/damu/1/edit?html,output There is a click event bound to the map which prints to the console. Clicking on either marker should not trigger that event, because the default options of |
Thanks! I'm not sure this is a bug actually. Some details:
Hope this makes sense! :) |
Ah, if this is intentional then that's fine, but it still doesn't seem great to me that just setting an event handler has the side effect of preventing bubbling. I would expect people to be confused by this, especially because the browser's bubbling does not work like this. For example, you don't have to call If you do want to keep this behaviour, I'd suggest adding some comments in the code to clarify that this is how it's supposed to work (right now this is the only comment as far as I can tell). And perhaps something about this in the documentation, too. |
See #3605 (comment) for more context about this design decision. I agree that this needs to be somewhere in the doc. |
Yeah, that makes sense, this would be a significant breaking change. I suppose both solutions have some element of surprise in them. Perhaps it would also help if we wouldn't call this stuff "bubbling", since that implies things work similar to DOM bubbling. I don't have good alternatives though. Anyway, thanks for your quick responses and providing context! |
This simple change should fix #3648.
Sadly, I can't add a unittest because happen doesn't seem to allow configuration of
relatedTarget
when firing an event (not sure why, cc @tmcw), so while in unittests this check is alwaystrue
.