Opened 11 years ago
Closed 11 years ago
#12655 closed bug (worksforme)
Speed up event binding in event.js
Reported by: | lihanli | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | git |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The event binding code is using two if statements to check if an event is a key event or a mouse event.
if ( rkeyEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; } if ( rmouseEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; }
But based on the rkeyevent and rmouseevent regexs and the list of events it is impossible for an event to be both a mouse event and key event.
Therefore I rewrote it as an if/else if statement. I'm putting the mouseevent test first because it's more common. Pull request incoming.
Note: See
TracTickets for help on using
tickets.
Thanks! Since that only happens once per event binding, i think it's safe to leave it as is.