Skip to content

Commit 2ac4067

Browse files
committed
Fixes #8456. Make sure parent is not null before crawling into its lap, so mouseenter is triggered on a mouseover event.
1 parent 6c124d3 commit 2ac4067

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/event.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ var withinElement = function( event ) {
661661

662662
// Chrome does something similar, the parentNode property
663663
// can be accessed but is null.
664-
if ( parent !== document && !parent.parentNode ) {
664+
if ( parent && parent !== document && !parent.parentNode ) {
665665
return;
666666
}
667667
// Traverse up the tree

test/unit/event.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,20 @@ test("hover()", function() {
683683
equals( times, 4, "hover handlers fired" );
684684
});
685685

686+
test("mouseover triggers mouseenter", function() {
687+
expect(1);
688+
689+
var count = 0,
690+
elem = jQuery("<a />");
691+
elem.mouseenter(function () {
692+
count++;
693+
});
694+
elem.trigger('mouseover');
695+
equals(count, 1, "make sure mouseover triggers a mouseenter" );
696+
697+
elem.remove();
698+
});
699+
686700
test("trigger() shortcuts", function() {
687701
expect(6);
688702

0 commit comments

Comments
 (0)