@@ -501,24 +501,25 @@ $.widget("ui.menu", {
501
501
if ( this . hasScroll ( ) ) {
502
502
// TODO merge with no-scroll-else
503
503
if ( ! this . active || this . last ( ) ) {
504
- this . activate ( event , this . element . children ( ":first" ) ) ;
504
+ this . activate ( event , this . element . children ( ".ui-menu-item :first" ) ) ;
505
505
return ;
506
506
}
507
507
var base = this . active . offset ( ) . top ,
508
508
height = this . element . height ( ) ,
509
- result = this . element . children ( "li " ) . filter ( function ( ) {
509
+ result = this . element . children ( ".ui-menu-item " ) . filter ( function ( ) {
510
510
var close = $ ( this ) . offset ( ) . top - base - height + $ ( this ) . height ( ) ;
511
511
// TODO improve approximation
512
512
return close < 10 && close > - 10 ;
513
513
} ) ;
514
514
515
515
// TODO try to catch this earlier when scrollTop indicates the last page anyway
516
516
if ( ! result . length ) {
517
- result = this . element . children ( ":last" ) ;
517
+ result = this . element . children ( ".ui-menu-item :last" ) ;
518
518
}
519
519
this . activate ( event , result ) ;
520
520
} else {
521
- this . activate ( event , this . element . children ( ! this . active || this . last ( ) ? ":first" : ":last" ) ) ;
521
+ this . activate ( event , this . element . children ( ".ui-menu-item" )
522
+ . filter ( ! this . active || this . last ( ) ? ":first" : ":last" ) ) ;
522
523
}
523
524
} ,
524
525
@@ -527,25 +528,26 @@ $.widget("ui.menu", {
527
528
if ( this . hasScroll ( ) ) {
528
529
// TODO merge with no-scroll-else
529
530
if ( ! this . active || this . first ( ) ) {
530
- this . activate ( event , this . element . children ( ":last" ) ) ;
531
+ this . activate ( event , this . element . children ( ".ui-menu-item :last" ) ) ;
531
532
return ;
532
533
}
533
534
534
535
var base = this . active . offset ( ) . top ,
535
536
height = this . element . height ( ) ;
536
- result = this . element . children ( "li " ) . filter ( function ( ) {
537
+ result = this . element . children ( ".ui-menu-item " ) . filter ( function ( ) {
537
538
var close = $ ( this ) . offset ( ) . top - base + height - $ ( this ) . height ( ) ;
538
539
// TODO improve approximation
539
540
return close < 10 && close > - 10 ;
540
541
} ) ;
541
542
542
543
// TODO try to catch this earlier when scrollTop indicates the last page anyway
543
544
if ( ! result . length ) {
544
- result = this . element . children ( ":first" ) ;
545
+ result = this . element . children ( ".ui-menu-item :first" ) ;
545
546
}
546
547
this . activate ( event , result ) ;
547
548
} else {
548
- this . activate ( event , this . element . children ( ! this . active || this . first ( ) ? ":last" : ":first" ) ) ;
549
+ this . activate ( event , this . element . children ( ".ui-menu-item" )
550
+ . filter ( ! this . active || this . first ( ) ? ":last" : ":first" ) ) ;
549
551
}
550
552
} ,
551
553
0 commit comments