diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2013-01-26 23:48:59 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2013-01-27 09:07:00 -0500 |
commit | 6f7b6915bf457c413476faefb2159df717c2c210 (patch) | |
tree | df9daba1eded8820c93441ab35ff370fd09e7551 /src/event.js | |
parent | a6c358d04693c5746e1557a2660dfccb169ad831 (diff) | |
download | jquery-6f7b6915bf457c413476faefb2159df717c2c210.tar.gz jquery-6f7b6915bf457c413476faefb2159df717c2c210.zip |
Fix #12656. Make event shorthands excludable.
Diffstat (limited to 'src/event.js')
-rw-r--r-- | src/event.js | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/src/event.js b/src/event.js index 6dd8d4a79..7cb141a63 100644 --- a/src/event.js +++ b/src/event.js @@ -481,10 +481,18 @@ jQuery.event = { } // Create a writable copy of the event object and normalize some properties - var i, prop, + var i, prop, copy, + type = event.type, originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); @@ -810,29 +818,5 @@ jQuery.fn.extend({ if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -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 ); - }; - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; } }); |