]> source.dussan.org Git - jquery.git/commitdiff
Cache reference to propHook lookup and result
authorRick Waldron <waldron.rick@gmail.com>
Thu, 22 Sep 2011 15:07:16 +0000 (11:07 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Thu, 22 Sep 2011 15:07:16 +0000 (11:07 -0400)
src/event.js

index b9da0183280e1021f6fbb0fa40828e9172e42f51..a9bf19706b446d532194eefe60d9e264e84c8c36 100644 (file)
@@ -484,8 +484,11 @@ jQuery.event = {
 
                // store a copy of the original event object
                // and "clone" to set read-only properties
-               var originalEvent = event;
+               var originalEvent = event,
+               propHook;
+
                event = jQuery.Event( originalEvent );
+               propHook = jQuery.event.propHooks[ event.type ];
 
                for ( var i = this.props.length, prop; i; ) {
                        prop = this.props[ --i ];
@@ -510,8 +513,8 @@ jQuery.event = {
                        event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
                }
 
-               if ( jQuery.event.propHooks[ event.type ] ) {
-                       event = jQuery.event.propHooks[ event.type ]( event, originalEvent );
+               if ( propHook ) {
+                       event = propHook( event, originalEvent );
                }
 
                return event;