aboutsummaryrefslogtreecommitdiffstats
path: root/src/event-alias.js
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2013-01-26 23:48:59 -0500
committerDave Methvin <dave.methvin@gmail.com>2013-01-27 09:07:00 -0500
commit6f7b6915bf457c413476faefb2159df717c2c210 (patch)
treedf9daba1eded8820c93441ab35ff370fd09e7551 /src/event-alias.js
parenta6c358d04693c5746e1557a2660dfccb169ad831 (diff)
downloadjquery-6f7b6915bf457c413476faefb2159df717c2c210.tar.gz
jquery-6f7b6915bf457c413476faefb2159df717c2c210.zip
Fix #12656. Make event shorthands excludable.
Diffstat (limited to 'src/event-alias.js')
-rw-r--r--src/event-alias.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/event-alias.js b/src/event-alias.js
new file mode 100644
index 000000000..0a87c5965
--- /dev/null
+++ b/src/event-alias.js
@@ -0,0 +1,15 @@
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+});
+
+jQuery.fn.hover = function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+};