Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

mouseleave behave like mouseout #9

Open
jfmmm opened this issue Sep 3, 2015 · 1 comment
Open

mouseleave behave like mouseout #9

jfmmm opened this issue Sep 3, 2015 · 1 comment

Comments

@jfmmm
Copy link

jfmmm commented Sep 3, 2015

You code seem to replace mouseleave with mouseout, witch is bad. If you have child element in the element you binded the event to, mouseout will trigger for every child as well as the targeted element. Mouseleave fix that and trigger only one when you exit the element you binded the event on.

removing this code fix the issue for me :

    mouseenter: {
        attachesTo: 'mouseover',
        eventTest: function(evt) {
            return (! withinElement(evt, evt.originalTarget(), 'fromElement'));
        }
    },
    mouseleave: {
        attachesTo: 'mouseout',
        eventTest: function(evt) {
            return (! withinElement(evt, evt.originalTarget(), 'toElement'));
        }
    },

why is this there?

@jfmmm
Copy link
Author

jfmmm commented Sep 3, 2015

jQuery has a nice demo to explain the difference between the two if needed (bottom of the page).
https://api.jquery.com/mouseleave/

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

No branches or pull requests

1 participant