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) { bindFn(element, 'mouseover', function(event) {
counter++; counter++;
if (counter == 1) { if (counter == 1) {
event.type = 'mouseenter';
mouseenter(event); mouseenter(event);
} }
}); });
bindFn(element, 'mouseout', function(event) { bindFn(element, 'mouseout', function(event) {
counter --; counter --;
if (counter == 0) { if (counter == 0) {
event.type = 'mouseleave';
mouseleave(event); mouseleave(event);
} }
}); });

View file

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