Spinner: use keyCode from ui.core.js

This commit is contained in:
Chi Cheng 2008-08-24 15:32:22 +00:00
parent ad3fd31b44
commit 293d6bc595

View File

@ -56,7 +56,7 @@ $.widget('ui.spinner', {
self._up(e); self._up(e);
}) })
.bind('keydown.spinner', function(e) { .bind('keydown.spinner', function(e) {
var KEYS = $.ui.spinner.keys; var KEYS = $.keyCode;
if (e.keyCode == KEYS.SPACE || e.keyCode == KEYS.RETURN) { if (e.keyCode == KEYS.SPACE || e.keyCode == KEYS.RETURN) {
$(this).addClass('ui-spinner-pressed'); $(this).addClass('ui-spinner-pressed');
if(!self.counter) self.counter = 1; if(!self.counter) self.counter = 1;
@ -95,7 +95,7 @@ $.widget('ui.spinner', {
self._down(e); self._down(e);
}) })
.bind('keydown.spinner', function(e) { .bind('keydown.spinner', function(e) {
var KEYS = $.ui.spinner.keys; var KEYS = $.keyCode;
if (e.keyCode == KEYS.SPACE || e.keyCode == KEYS.RETURN) { if (e.keyCode == KEYS.SPACE || e.keyCode == KEYS.RETURN) {
$(this).addClass('ui-spinner-pressed'); $(this).addClass('ui-spinner-pressed');
if(!self.counter) self.counter = 1; if(!self.counter) self.counter = 1;
@ -173,7 +173,7 @@ $.widget('ui.spinner', {
this._propagate('change', e); this._propagate('change', e);
}, },
_keydown: function(e) { _keydown: function(e) {
var KEYS = $.ui.spinner.keys; var KEYS = $.keyCode;
if(e.keyCode == KEYS.UP) this._up(e); if(e.keyCode == KEYS.UP) this._up(e);
if(e.keyCode == KEYS.DOWN) this._down(e); if(e.keyCode == KEYS.DOWN) this._down(e);
@ -278,26 +278,6 @@ $.extend($.ui.spinner, {
} }
return s; return s;
} }
},
keys: {
BACKSPACE: 8,
TAB: 9,
RETURN: 13,
ESC: 27,
SPACE: 32,
PAGEUP: 33,
PAGEDOWN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
DEL: 46,
COMMA: 188,
PERIOD: 190,
NUMPAD_DECIMAL: 110,
NUMPAD_SUBTRACT: 109
} }
}); });