aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Bolter <david.bolter@gmail.com>2008-11-13 16:24:44 +0000
committerDavid Bolter <david.bolter@gmail.com>2008-11-13 16:24:44 +0000
commited4f58c6d3c914baafaf07ab1d168e6c199b8693 (patch)
treeb83fd4308a1f0b44f5f2c3e92fb7b53097b761a2
parent976b9b57bb0156767e6fd88b3adf746674a9f971 (diff)
downloadjquery-ui-ed4f58c6d3c914baafaf07ab1d168e6c199b8693.tar.gz
jquery-ui-ed4f58c6d3c914baafaf07ab1d168e6c199b8693.zip
refactored keyboard handling to a switch statement for clarity.
-rw-r--r--ui/ui.accordion.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/ui/ui.accordion.js b/ui/ui.accordion.js
index 2831475ae..2b2da9f21 100644
--- a/ui/ui.accordion.js
+++ b/ui/ui.accordion.js
@@ -106,18 +106,18 @@ $.widget("ui.accordion", {
var currentIndex = this.options.headers.index(e.target);
var toFocus = false;
- if (e.keyCode == keyCode.RIGHT || e.keyCode == keyCode.DOWN){
-
- toFocus = this.options.headers[(currentIndex + 1) % length];
-
- } else if (e.keyCode == keyCode.LEFT || e.keyCode == keyCode.UP) {
-
- toFocus = this.options.headers[(currentIndex - 1 + length) % length];
-
- } else if (e.keyCode == keyCode.SPACE || e.keyCode == keyCode.ENTER) {
-
- return clickHandler.call(this.element[0], { target: e.target });
-
+ switch(e.keyCode) {
+ case keyCode.RIGHT:
+ case keyCode.DOWN:
+ toFocus = this.options.headers[(currentIndex + 1) % length];
+ break;
+ case keyCode.LEFT:
+ case keyCode.UP:
+ toFocus = this.options.headers[(currentIndex - 1 + length) % length];
+ break;
+ case keyCode.SPACE:
+ case keyCode.ENTER:
+ return clickHandler.call(this.element[0], { target: e.target });
}
if (toFocus) {