diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-09-27 09:10:18 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-09-27 09:10:18 -0400 |
commit | dda7bcb6383ed0fee9dcd1ae5f0a6e1dcc160c6b (patch) | |
tree | b5e67b331f0971d25cfacf17868e15a5147a4735 /ui | |
parent | 0ccc78698b55d5e1bc336bb754b546a9ad19ea5c (diff) | |
download | jquery-ui-dda7bcb6383ed0fee9dcd1ae5f0a6e1dcc160c6b.tar.gz jquery-ui-dda7bcb6383ed0fee9dcd1ae5f0a6e1dcc160c6b.zip |
Autocomplete (Menu): Only traverse through .ui-menu-item elements for paging. Fixes #6029 - Autocomplete: Custom item can be activated (and result in error) on PageUp/PageDown key click.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 3dbcb9cf4..680a81f29 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -501,12 +501,12 @@ $.widget("ui.menu", { if (this.hasScroll()) { // TODO merge with no-scroll-else if (!this.active || this.last()) { - this.activate(event, this.element.children(":first")); + this.activate(event, this.element.children(".ui-menu-item:first")); return; } var base = this.active.offset().top, height = this.element.height(), - result = this.element.children("li").filter(function() { + result = this.element.children(".ui-menu-item").filter(function() { var close = $(this).offset().top - base - height + $(this).height(); // TODO improve approximation return close < 10 && close > -10; @@ -514,11 +514,12 @@ $.widget("ui.menu", { // TODO try to catch this earlier when scrollTop indicates the last page anyway if (!result.length) { - result = this.element.children(":last"); + result = this.element.children(".ui-menu-item:last"); } this.activate(event, result); } else { - this.activate(event, this.element.children(!this.active || this.last() ? ":first" : ":last")); + this.activate(event, this.element.children(".ui-menu-item") + .filter(!this.active || this.last() ? ":first" : ":last")); } }, @@ -527,13 +528,13 @@ $.widget("ui.menu", { if (this.hasScroll()) { // TODO merge with no-scroll-else if (!this.active || this.first()) { - this.activate(event, this.element.children(":last")); + this.activate(event, this.element.children(".ui-menu-item:last")); return; } var base = this.active.offset().top, height = this.element.height(); - result = this.element.children("li").filter(function() { + result = this.element.children(".ui-menu-item").filter(function() { var close = $(this).offset().top - base + height - $(this).height(); // TODO improve approximation return close < 10 && close > -10; @@ -541,11 +542,12 @@ $.widget("ui.menu", { // TODO try to catch this earlier when scrollTop indicates the last page anyway if (!result.length) { - result = this.element.children(":first"); + result = this.element.children(".ui-menu-item:first"); } this.activate(event, result); } else { - this.activate(event, this.element.children(!this.active || this.first() ? ":last" : ":first")); + this.activate(event, this.element.children(".ui-menu-item") + .filter(!this.active || this.first() ? ":last" : ":first")); } }, |