-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Support onMouseOver #340
Comments
Better yet, support it! |
Yeah, is there a particular reason it's not supported? |
Curious if you've seen the |
We discussed this for a bit on IRC -- @BenQuinn was just confused that (I agree that enter/leave are much more useful and suggested that over/out are likely missing simply because no one has needed them!) |
Agree - I believe there are a few extra allocations (not-pooled) occuring in the event system already today. I'd love to track those down before adding more mouse-move event allocations. If you open the memory profiler in Chrome and move the mouse around, you'll see memory being allocated (and then properly freed of course) but if we use Edit: Just checked out |
Just started to look a little bit into the allocations here. Redefining trapBubbledEvent in ReactEventEmitter with:
still shows allocations in the Chrome memory timeline view, so I'm not convinced that there's anything we can do here? (Replacing trapBubbledEvent itself with a noop makes the allocations go away. EventListener.listen simply calls addEventListener.) |
@jordwalke I am pretty sure we have done all we can here -- at least I think we've tracked down every callsite where PooledClass would have helped us. I updated our recast transforms to log every syntax construct that would cause an obvious allocation and couldn't find anything. I was thinking maybe there was an array slice or a bind() in there, but @spicyj's experiment shows that this is not the case. |
(I didn't verify that we don't have more allocations than the empty-function case; I don't know of a good way to do so.) |
I might be misinformed, but isn't there quite a difference in use cases between mouseenter and mouseover events? Here's a theoretical (non-react) example working with some hover states for nested elements: I tried to apply the above concept in react (with nested components) using onMouseEnter instead, but it obviously fails because it's only triggered once on the top-most element. Moving into a child element and back has no effect. Maybe there's a better approach for this in react altogether? |
Fixes facebook#340. Test Plan: Ported @danielstocks's jsfiddle (linked in the issue) to React and the hover effect worked properly.
@danielstocks If you render the child hierarchy with React, you can listen to |
https://github.com/facebook/react/blob/master/src/eventPlugins/SimpleEventPlugin.js#L153
Someone had the trouble in IRC about it.
Edit: changed the subject from "document it" to "support it", because the documentation issue is already at #171.
The text was updated successfully, but these errors were encountered: