From 7babc7f20393acb44d4fced34fe86fde65f893a0 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Thu, 22 Sep 2011 11:07:16 -0400 Subject: [PATCH] Cache reference to propHook lookup and result --- src/event.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/event.js b/src/event.js index b9da01832..a9bf19706 100644 --- a/src/event.js +++ b/src/event.js @@ -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; -- 2.39.5