Permalink
Browse files

Update src/lib/control/typeahead/Typeahead.js

Fix the issue that non-result node may be chosen.
  • Loading branch information...
1 parent 01f3294 commit 5d5b11b2562996602d9f30663dc677592f47fa59 @hedgerwang committed Aug 31, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/lib/control/typeahead/Typeahead.js
@@ -331,8 +331,11 @@ JX.install('Typeahead', {
* @task control
*/
submit : function() {
- if (this._focus >= 0 && this._display[this._focus]) {
- this._choose(this._display[this._focus]);
+ var result = this._focus >= 0 ?
+ JX.DOM.scry(this._root, 'a', 'typeahead-result')[this._focus] :
+ null;
+ if (result) {
+ this._choose(result);
return true;
} else {
result = this.invoke('query', this._control.value);

0 comments on commit 5d5b11b

Please sign in to comment.