diff --git a/ui/ui.accordion.js b/ui/ui.accordion.js index 973c9706e..307264946 100644 --- a/ui/ui.accordion.js +++ b/ui/ui.accordion.js @@ -115,7 +115,7 @@ $.widget("ui.accordion", { if (this.options.disabled || event.altKey || event.ctrlKey) return; - var keyCode = $.keyCode; + var keyCode = $.ui.keyCode; var length = this.options.headers.length; var currentIndex = this.options.headers.index(event.target); diff --git a/ui/ui.core.js b/ui/ui.core.js index 84a7fcbae..d447a14e7 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -9,40 +9,9 @@ */ ;(function($) { -/** jQuery core modifications and additions **/ -$.keyCode = { - BACKSPACE: 8, - CAPS_LOCK: 20, - COMMA: 188, - CONTROL: 17, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - INSERT: 45, - LEFT: 37, - NUMPAD_ADD: 107, - NUMPAD_DECIMAL: 110, - NUMPAD_DIVIDE: 111, - NUMPAD_ENTER: 108, - NUMPAD_MULTIPLY: 106, - NUMPAD_SUBTRACT: 109, - PAGE_DOWN: 34, - PAGE_UP: 33, - PERIOD: 190, - RIGHT: 39, - SHIFT: 16, - SPACE: 32, - TAB: 9, - UP: 38 -}; - var _remove = $.fn.remove, isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9); - //Helper functions and ui object $.ui = { @@ -126,7 +95,37 @@ $.ui = { isOver: function(y, x, top, left, height, width) { //Determines when x, y coordinates is over "b" element return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width); + }, + + keyCode: { + BACKSPACE: 8, + CAPS_LOCK: 20, + COMMA: 188, + CONTROL: 17, + DELETE: 46, + DOWN: 40, + END: 35, + ENTER: 13, + ESCAPE: 27, + HOME: 36, + INSERT: 45, + LEFT: 37, + NUMPAD_ADD: 107, + NUMPAD_DECIMAL: 110, + NUMPAD_DIVIDE: 111, + NUMPAD_ENTER: 108, + NUMPAD_MULTIPLY: 106, + NUMPAD_SUBTRACT: 109, + PAGE_DOWN: 34, + PAGE_UP: 33, + PERIOD: 190, + RIGHT: 39, + SHIFT: 16, + SPACE: 32, + TAB: 9, + UP: 38 } + }; // WAI-ARIA normalization diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js index 96414e7eb..37e55927c 100644 --- a/ui/ui.dialog.js +++ b/ui/ui.dialog.js @@ -124,7 +124,7 @@ $.widget("ui.dialog", { // setting outline to 0 prevents a border on focus in Mozilla .attr('tabIndex', -1).css('outline', 0).keydown(function(ev) { (options.closeOnEscape && ev.keyCode - && ev.keyCode == $.keyCode.ESCAPE && self.close()); + && ev.keyCode == $.ui.keyCode.ESCAPE && self.close()); }) .attr({ role: 'dialog', @@ -226,7 +226,7 @@ $.widget("ui.dialog", { // prevent tabbing out of modal dialogs (this.options.modal && this.uiDialog.bind('keypress.ui-dialog', function(event) { - if (event.keyCode != $.keyCode.TAB) { + if (event.keyCode != $.ui.keyCode.TAB) { return; } @@ -508,7 +508,7 @@ $.extend($.ui.dialog.overlay, { // allow closing by pressing the escape key $(document).bind('keydown.dialog-overlay', function(event) { (dialog.options.closeOnEscape && event.keyCode - && event.keyCode == $.keyCode.ESCAPE && dialog.close()); + && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close()); }); // handle window resize