Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 75a3635

Browse files
Listview: Added a class to set border-bottom on the last LI. This fixes missing border on filtered lists and on browsers that don't support :last-child. Fixes #4614 - Items filtered from listview missing a border.
1 parent 8b691bc commit 75a3635

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

css/structure/jquery.mobile.listview.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ol.ui-listview, ol.ui-listview .ui-li-divider { counter-reset: listnumbering; }
1212
ol.ui-listview .ui-link-inherit:before, ol.ui-listview .ui-li-static:before, .ui-li-dec { font-size: .8em; display: inline-block; padding-right: .3em; font-weight: normal; counter-increment: listnumbering; content: counter(listnumbering) ". "; }
1313
ol.ui-listview .ui-li-jsnumbering:before { content: "" !important; } /* to avoid chance of duplication */
1414
.ui-listview-inset .ui-li { border-right-width: 1px; border-left-width: 1px; }
15-
.ui-li:last-child, .ui-li.ui-field-contain:last-child { border-bottom-width: 1px; }
15+
.ui-li-last, .ui-li.ui-field-contain.ui-li-last { border-bottom-width: 1px; }
1616
.ui-li>.ui-btn-inner { display: block; position: relative; padding: 0; }
1717
.ui-li .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li { padding: .7em 15px; display: block; }
1818
.ui-li-has-thumb .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li-has-thumb { min-height: 60px; padding-left: 100px; }

js/jquery.mobile.listview.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,14 @@ $.widget( "mobile.listview", $.mobile.widget, {
6262
$topli,
6363
$bottomli;
6464

65-
if ( this.options.inset ) {
66-
$li = this.element.children( "li" );
67-
// at create time the li are not visible yet so we need to rely on .ui-screen-hidden
68-
$visibleli = create ? $li.not( ".ui-screen-hidden" ) : $li.filter( ":visible" );
65+
$li = this.element.children( "li" );
66+
// at create time the li are not visible yet so we need to rely on .ui-screen-hidden
67+
$visibleli = create ? $li.not( ".ui-screen-hidden" ) : $li.filter( ":visible" );
6968

69+
// ui-li-last is used for setting border-bottom on the last li
70+
$li.find( ".ui-li-last" ).removeClass( "ui-li-last" );
71+
72+
if ( this.options.inset ) {
7073
this._removeCorners( $li );
7174

7275
// Select the first visible li element
@@ -86,7 +89,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
8689

8790
// Select the last visible li element
8891
$bottomli = $visibleli.last()
89-
.addClass( "ui-corner-bottom" );
92+
.addClass( "ui-corner-bottom ui-li-last" );
9093

9194
$bottomli.add( $bottomli.find( ".ui-btn-inner" ) )
9295
.find( ".ui-li-link-alt" )
@@ -95,6 +98,8 @@ $.widget( "mobile.listview", $.mobile.widget, {
9598
.find( ".ui-li-thumb" )
9699
.not(".ui-li-icon")
97100
.addClass( "ui-corner-bl" );
101+
} else {
102+
$visibleli.last().addClass( "ui-li-last" );
98103
}
99104
if ( !create ) {
100105
this.element.trigger( "updatelayout" );

0 commit comments

Comments
 (0)