Skip to content

Commit

Permalink
Menu: skip over elements that aren't menu items.
Browse files Browse the repository at this point in the history
Fixes #5188 - Refactor menu rendering for more customizing.
  • Loading branch information
scottgonzalez committed Mar 20, 2010
1 parent 65d8fa2 commit 22ba931
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
23 changes: 0 additions & 23 deletions demos/autocomplete/categories.html
Expand Up @@ -19,29 +19,6 @@
}
</style>
<script type="text/javascript">
$.extend( $.ui.menu.prototype, {
next: function() {
this.move("next", ".ui-menu-item:first");
},

previous: function() {
this.move("prev", ".ui-menu-item:last");
},

move: function(direction, edge) {
if (!this.active) {
this.activate(this.element.children(edge));
return;
}
var next = this.active[direction + "All"]('.ui-menu-item').eq( 0 );
if (next.length) {
this.activate(next);
} else {
this.activate(this.element.children(edge));
}
}
});

$.widget("custom.catcomplete", $.ui.autocomplete, {
_renderMenu: function( ul, items ) {
var self = this,
Expand Down
6 changes: 3 additions & 3 deletions ui/jquery.ui.autocomplete.js
Expand Up @@ -391,11 +391,11 @@ $.widget("ui.menu", {
},

next: function(event) {
this.move("next", "li:first", event);
this.move("next", ".ui-menu-item:first", event);
},

previous: function(event) {
this.move("prev", "li:last", event);
this.move("prev", ".ui-menu-item:last", event);
},

first: function() {
Expand All @@ -411,7 +411,7 @@ $.widget("ui.menu", {
this.activate(event, this.element.children(edge));
return;
}
var next = this.active[direction]();
var next = this.active[direction + "All"](".ui-menu-item").eq(0);
if (next.length) {
this.activate(event, next);
} else {
Expand Down

0 comments on commit 22ba931

Please sign in to comment.