ccampbell/mousetrap — pull request #19 by st-boost (2012-07-06 09:48:01+00:00)
Title: A few touchups

- Eliminated repetitive normalization by modifying `_addEvent` to patch IE behavior. Also, optimized `_addEvent` to cache browser compatibility
- Optimized `_keyCodeFromEvent` with a lookup table, then moved calling to a more logical location, then inlined it.
- Inlined `_stop` to increase efficiency and readability.
- Optimized the loop in `_fireCallback`.
- Optimized `_modifiersMatch`, especially for common use cases.
- Optimized the loop in `_bindMultiple` to remove repeated calculation of `.length`.
- Inlined `_bindMultiple` to increase efficiency and readability.
- Moved all variable declarations to the top of their respective functions (for clarity - see "variable hoisting").
- Fixed `trigger` to be more robust: don't throw an error if there is no bound event, and don't accidentally use Object.prototype.
- Fixed `trigger` and IE's `_addEvent` to execute callbacks in the correct context.
- Changed `Mousetrap.addEvent` into a pointer to `_addEvent`, for efficiency.