Skip to content
Permalink
Browse files

Shave some time off array setup in trigger/handle

  • Loading branch information...
dmethvin committed Apr 11, 2011
1 parent 7957516 commit a5071d49ba29ba115954845db9363aa6459f1a84
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/event.js
@@ -354,7 +354,7 @@ jQuery.event = {
event.target = elem;

// Clone any incoming data and prepend the event, creating the handler arg list
data = jQuery.makeArray( data );
data = data? jQuery.makeArray( data ) : [];
data.unshift( event );

var cur = elem,
@@ -419,7 +419,7 @@ jQuery.event = {
// Snapshot the handlers list since a called handler may add/remove events.
var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
run_all = !event.exclusive && !event.namespace,
args = jQuery.makeArray( arguments );
args = Array.prototype.slice.call( arguments, 0 );

This comment has been minimized.

Copy link
@jdalton

jdalton Apr 16, 2011

Member

Maybe smaller to do [].slice.call, I know it created a new array each time, but its an array literal (meaning no perf cost).


// Use the fix-ed Event rather than the (read-only) native event
args[0] = event;

0 comments on commit a5071d4

Please sign in to comment.
You can’t perform that action at this time.