Skip to main content

Bug Tracker

Side navigation

Ticket #3498: mouseenter.diff


File mouseenter.diff, 0.8 KB (added by phiggins, October 20, 2008 12:14PM UTC)

shorten hover, add optional second param, add mouseenter/leave methods

Index: event.js
===================================================================
--- event.js	(revision 5893)
+++ event.js	(working copy)
@@ -467,7 +467,7 @@
 	},
 
 	hover: function(fnOver, fnOut) {
-		return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
+		return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
 	},
 
 	ready: function(fn) {
@@ -578,8 +578,8 @@
 }
 
 jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
-	"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
-	"submit,keydown,keypress,keyup,error").split(","), function(i, name){
+	"mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
+	"change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
 
 	// Handle event binding
 	jQuery.fn[name] = function(fn){

Download in other formats:

Original Format