vendor/assets/javascripts/mousetrap.js in mousetrap-rails-0.0.11 vs vendor/assets/javascripts/mousetrap.js in mousetrap-rails-0.0.12
- old
+ new
@@ -15,14 +15,14 @@
* limitations under the License.
*
* Mousetrap is a simple keyboard shortcut library for Javascript with
* no external dependencies
*
- * @version 1.4.4
+ * @version 1.4.5
* @url craig.is/killing/mice
*/
-(function() {
+(function(window, document, undefined) {
/**
* mapping of special keycodes to their corresponding keys
*
* everything in this dictionary cannot use keypress events
@@ -244,16 +244,10 @@
// trigger the event. shift+a will though.
if (!e.shiftKey) {
character = character.toLowerCase();
}
- // String.fromCharCode(32) for spacebar returns " " for the
- // character name, make sure it matches the mousetrap name
- if (character == ' ') {
- return 'space';
- }
-
return character;
}
// for non keypress events the special maps are needed
if (_MAP[e.which]) {
@@ -916,11 +910,11 @@
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
return false;
}
// stop for input, select, and textarea
- return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || (element.contentEditable && element.contentEditable == 'true');
+ return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
},
/**
* exposes _handleKey publicly so it can be overwritten by extensions
*/
@@ -932,6 +926,6 @@
// expose mousetrap as an AMD module
if (typeof define === 'function' && define.amd) {
define(Mousetrap);
}
-}) ();
+}) (window, document);