Skip to content
Permalink
Browse files

Fixes #8456. Make sure parent is not null before crawling into its la…

…p, so mouseenter is triggered on a mouseover event.
  • Loading branch information...
dmethvin committed Mar 10, 2011
1 parent 6c124d3 commit 2ac4067a639856a6035c3bd00aab132c9714b52d
Showing with 15 additions and 1 deletion.
  1. +1 −1 src/event.js
  2. +14 −0 test/unit/event.js
@@ -661,7 +661,7 @@ var withinElement = function( event ) {

// Chrome does something similar, the parentNode property
// can be accessed but is null.
if ( parent !== document && !parent.parentNode ) {
if ( parent && parent !== document && !parent.parentNode ) {
return;
}
// Traverse up the tree
@@ -683,6 +683,20 @@ test("hover()", function() {
equals( times, 4, "hover handlers fired" );
});

test("mouseover triggers mouseenter", function() {
expect(1);

var count = 0,
elem = jQuery("<a />");
elem.mouseenter(function () {
count++;
});
elem.trigger('mouseover');
equals(count, 1, "make sure mouseover triggers a mouseenter" );

elem.remove();
});

test("trigger() shortcuts", function() {
expect(6);

0 comments on commit 2ac4067

Please sign in to comment.
You can’t perform that action at this time.