Merge branch 'fix-8456-lost-mouseenter' of https://github.com/dmethvin/jquery into...
authorjeresig <jeresig@gmail.com>
Mon, 21 Mar 2011 14:53:57 +0000 (10:53 -0400)
committerjeresig <jeresig@gmail.com>
Mon, 21 Mar 2011 14:53:57 +0000 (10:53 -0400)
src/event.js
test/unit/event.js

index 61c8a93..bc2cf76 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 d549879..1e40e0f 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);