Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix delegation issue introduced in 1.4.2, #2367. #2467

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

In 1.4.2 mootools uses native mouseenter and mouseleave if available. Though, those can not be used in delegation because they don't bubble.

The problem lies in:

var elementEvent = Element.Events[_type];
if (elementEvent && elementEvent.condition){
  var __match = match, condition = elementEvent.condition;
  match = function(target, event){
    return __match(target, event) && condition.call(target, event, type);
  };
}

The type variable was being correctly translated from mouseenter to mouseover and mouseleave to mouseou. When mootools was using the native version, Element.Events[_type] was not being set, causing the if condition to be always false.

Worth mentioning that this problem was not only related to tables and table rows/cells. It was present everywhere.
Check this fiddle that replicates the problem with divs: http://jsfiddle.net/WysPu/1
This PR proposes a fix for this, feel free to suggest modifications to the code in order to get merged. This problem was causing us to use 1.4.1 in a project for too long.

arian added a commit to arian/mootools-core that referenced this pull request Feb 11, 2013

Fixes #2367, closes #2467 - Use the check when using delegation for m…
…ouseenter.

Since 1.4.2 the native mouseenter/mouseleave events are used, when available
(Firefox, IE). For delegation however, it should has to use mouseover/mouseout
because it should still fire each time an element is entered or left so it can
check if it matches the selector.

arian added a commit to arian/mootools-core that referenced this pull request Feb 11, 2013

Fixes #2367, closes #2467 - Use the check when using delegation for m…
…ouseenter.

Since 1.4.2 the native mouseenter/mouseleave events are used, when available
(Firefox, IE). For delegation however, it should has to use mouseover/mouseout
because it should still fire each time an element is entered or left so it can
check if it matches the selector.

thanks @luisateixeira for the research/fix
Owner

arian commented Feb 11, 2013

Hey, thanks for your research and fix. I opened a new pull request with a slightly other fix #2470

@arian arian closed this Feb 11, 2013

arian added a commit to arian/mootools-core that referenced this pull request Feb 11, 2013

Fixes #2367, closes #2467 - Use the check when using delegation for m…
…ouseenter.

Since 1.4.2 the native mouseenter/mouseleave events are used, when available
(Firefox, IE). For delegation however, it should has to use mouseover/mouseout
because it should still fire each time an element is entered or left so it can
check if it matches the selector.

thanks @luisateixeira for the research/fix

arian added a commit that referenced this pull request Feb 11, 2013

Fixes #2367, closes #2467 - Use the check when using delegation for m…
…ouseenter.

Since 1.4.2 the native mouseenter/mouseleave events are used, when available
(Firefox, IE). For delegation however, it should has to use mouseover/mouseout
because it should still fire each time an element is entered or left so it can
check if it matches the selector.

thanks @luisateixeira for the research/fix

arian added a commit to ibolmo/mootools-core that referenced this pull request Feb 16, 2014

Fixes #2367, closes #2467 - Use the check when using delegation for m…
…ouseenter.

Since 1.4.2 the native mouseenter/mouseleave events are used, when available
(Firefox, IE). For delegation however, it should has to use mouseover/mouseout
because it should still fire each time an element is entered or left so it can
check if it matches the selector.

thanks @luisateixeira for the research/fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment