summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2011-05-24 15:06:03 -0700
committerFelix Nagel <info@felixnagel.com>2011-05-24 15:06:03 -0700
commit0253a6365314beb0560bff796a115c90e7dcddce (patch)
tree6258f4bc4ae142478ee490baac4fb5b6c5d5106e
parented77e04dc192e53ad4437a45e4a8c4d841b27c8f (diff)
parent566f58fc4edbf2d95d005c03338583c9b393f401 (diff)
downloadjquery-ui-0253a6365314beb0560bff796a115c90e7dcddce.tar.gz
jquery-ui-0253a6365314beb0560bff796a115c90e7dcddce.zip
Merge pull request #114 from trollixx/selectmenu
Support for non-Latin typeahead
-rw-r--r--ui/jquery.ui.selectmenu.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index 2068535ec..61c642f35 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/ui/jquery.ui.selectmenu.js
@@ -123,11 +123,13 @@ $.widget("ui.selectmenu", {
break;
default:
ret = true;
- self._typeAhead(event.keyCode, 'mouseup');
- break;
}
return ret;
})
+ .bind('keypress.selectmenu', function(event) {
+ self._typeAhead(event.which, 'mouseup');
+ return true;
+ })
.bind('mouseover.selectmenu focus.selectmenu', function() {
if (!o.disabled) {
$(this).addClass(self.widgetBaseClass + '-focus ui-state-hover');
@@ -223,10 +225,12 @@ $.widget("ui.selectmenu", {
break;
default:
ret = true;
- self._typeAhead(event.keyCode,'focus');
- break;
}
return ret;
+ })
+ .bind('keypress.selectmenu', function(event) {
+ self._typeAhead(event.which, 'focus');
+ return true;
});
// needed when window is resized
@@ -420,7 +424,7 @@ $.widget("ui.selectmenu", {
},
_typeAhead: function(code, eventType){
- var self = this, focusFound = false, C = String.fromCharCode(code);
+ var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase();
c = C.toLowerCase();
if (self.options.typeAhead == 'sequential') {
@@ -440,7 +444,7 @@ $.widget("ui.selectmenu", {
// allow the typeahead attribute on the option tag for a more specific lookup
var thisText = $(this).attr('typeahead') || $(this).text();
if (thisText.indexOf(find+C) == 0) {
- focusOptSeq(this,i, C)
+ focusOptSeq(this,i,C)
} else if (thisText.indexOf(find+c) == 0) {
focusOptSeq(this,i,c)
}