Skip to content

Commit

Permalink
fixed mouseenter/mouseleave
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew authored and dgreensp committed Jul 12, 2012
1 parent fb3ccd7 commit 75696a8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/liveui/liveevents_w3c.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Meteor.ui._event._loadW3CImpl = function() {
var focusBlurMode = ('onfocusin' in document.createElement("DIV")) ?
SIMULATE_NEITHER : SIMULATE_FOCUSIN_FOCUSOUT;

// mouseenter/mouseleave is non-bubbling mousein/mouseout. It's
// mouseenter/mouseleave is non-bubbling mouseover/mouseout. It's
// standard but only IE and Opera seem to support it,
// so we simulate it (which works in IE but not in Opera for some reason).
var simulateMouseEnterLeave = (! window.opera);
Expand Down Expand Up @@ -118,13 +118,14 @@ Meteor.ui._event._loadW3CImpl = function() {
Meteor.ui._event._handleEventFunc(
Meteor.ui._event._fixEvent(event));


// fire mouseleave after mouseout
if (simulateMouseEnterLeave &&
(event.currentTarget === event.target)) {
if (event.type === 'mousein')
sendUIEvent('mouseenter', event.target, false);
if (simulateMouseEnterLeave && event.currentTarget !== event.relatedTarget && !jQuery.contains(event.currentTarget, event.relatedTarget)) {
if (event.type === 'mouseover'){
sendUIEvent('mouseenter', event.currentTarget, false);
}
else if (event.type === 'mouseout') {
sendUIEvent('mouseleave', event.target, false);
sendUIEvent('mouseleave', event.currentTarget, false);
}
}
};
Expand All @@ -145,7 +146,7 @@ Meteor.ui._event._loadW3CImpl = function() {
}
if (simulateMouseEnterLeave) {
if (eventType === 'mouseenter')
installCapturer('mousein');
installCapturer('mouseover');
else if (eventType === 'mouseleave')
installCapturer('mouseout');
}
Expand Down

0 comments on commit 75696a8

Please sign in to comment.