Events.js icon indicating copy to clipboard operation
Events.js copied to clipboard

mouseleave behave like mouseout

Open jfmmm opened this issue 9 years ago • 1 comments

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 avatar Sep 03 '15 16:09 jfmmm

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

jfmmm avatar Sep 03 '15 16:09 jfmmm