]> source.dussan.org Git - jquery-ui.git/commitdiff
Menu: skip over elements that aren't menu items.
authorScott González <scott.gonzalez@gmail.com>
Sat, 20 Mar 2010 18:37:25 +0000 (14:37 -0400)
committerScott González <scott.gonzalez@gmail.com>
Sat, 20 Mar 2010 18:37:25 +0000 (14:37 -0400)
Fixes #5188 - Refactor menu rendering for more customizing.

demos/autocomplete/categories.html
ui/jquery.ui.autocomplete.js

index 2340b32f4609025f19f1fc0d32b018ce14e3a9e5..bb59bf31e89280b66495fa70a48b3b520c059191 100644 (file)
        }
        </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,
index f9fa50380771f9497803b56185b634e1cdcfc534..c5b78a6e350127b5ab9802d62840550c07c44624 100644 (file)
@@ -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() {
@@ -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 {