]> source.dussan.org Git - jquery.git/commitdiff
Fixes #8456. Make sure parent is not null before crawling into its lap, so mouseenter... 266/head
authorDave Methvin <dave.methvin@gmail.com>
Thu, 10 Mar 2011 03:38:26 +0000 (22:38 -0500)
committerDave Methvin <dave.methvin@gmail.com>
Thu, 10 Mar 2011 03:38:26 +0000 (22:38 -0500)
src/event.js
test/unit/event.js

index f7e0a08c05759b9ef93856faa8e7399dbd7b100c..2620646da0615f16195a867b16a10bb6da8b8e3b 100644 (file)
@@ -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
index b7b26046214df7645e6d71836fd489e2eed010fc..d66aaac9baf9964c8722c1e50d3ca3536b87577a 100644 (file)
@@ -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);