fix(mouseenter): FF no longer throws exceptions

This commit is contained in:
Misko Hevery 2012-04-20 11:27:35 -07:00
parent 1d26acb874
commit 43d15f830f
2 changed files with 4 additions and 6 deletions

View file

@ -559,14 +559,12 @@ forEach({
bindFn(element, 'mouseover', function(event) {
counter++;
if (counter == 1) {
event.type = 'mouseenter';
mouseenter(event);
}
});
bindFn(element, 'mouseout', function(event) {
counter --;
if (counter == 0) {
event.type = 'mouseleave';
mouseleave(event);
}
});

View file

@ -691,13 +691,13 @@ describe('jqLite', function() {
parent.bind('mouseenter', function() { log += 'parentEnter;'; });
parent.bind('mouseleave', function() { log += 'parentLeave;'; });
parent.mouseover = function(event) { parent.data('bind').mouseover(event || {}); };
parent.mouseout = function(event) { parent.data('bind').mouseout(event || {}); };
parent.mouseover = function() { browserTrigger(parent, 'mouseover'); };
parent.mouseout = function() { browserTrigger(parent, 'mouseout'); };
child.bind('mouseenter', function() { log += 'childEnter;'; });
child.bind('mouseleave', function() { log += 'childLeave;'; });
child.mouseover = function(event) { child.data('bind').mouseover(event || {}); };
child.mouseout = function(event) { child.data('bind').mouseout(event || {}); };
child.mouseover = function() { browserTrigger(child, 'mouseover'); };
child.mouseout = function() { browserTrigger(child, 'mouseout'); };
});
afterEach(function() {