Permalink
Browse files

fixed up logic and code style for the _removeCorners "which" argument…

…. Thx for the logic suggestion, @eugenb1. Fixes #1996.
  • Loading branch information...
scottjehl
scottjehl committed Jul 10, 2011
1 parent 4703fe0 commit e567742c90e3c4bd5423298c4d714e92867f1d8e
Showing with 15 additions and 8 deletions.
  1. +15 −8 js/jquery.mobile.listview.js
@@ -49,13 +49,20 @@ $.widget( "mobile.listview", $.mobile.widget, {
},
_removeCorners: function( li, which ) {
which = which || [ "top", "bottom" ];
var classes = {
top: "ui-corner-top ui-corner-tr ui-corner-tl",
bottom: "ui-corner-bottom ui-corner-br ui-corner-bl"
};
li.add( li.find( ".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb" ) )
.removeClass( "ui-corner-top ui-corner-bottom ui-corner-br ui-corner-bl ui-corner-tr ui-corner-tl" );
var top = "ui-corner-top ui-corner-tr ui-corner-tl",
bot = "ui-corner-bottom ui-corner-br ui-corner-bl";
li = li.add( li.find( ".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb" ) );
if ( which === "top" ) {
li.removeClass( top );
}
else if ( which === "bottom" ) {
li.removeClass( bot );
}
else {
li.removeClass( top + " " + bot );
}
},
refresh: function( create ) {
@@ -171,7 +178,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
if ( item.prev().prev().length ) {
self._removeCorners( item.prev() );
} else if ( item.prev().length ) {
self._removeCorners( item.prev(), ["bottom"] );
self._removeCorners( item.prev(), "bottom" );
}
}
}

0 comments on commit e567742

Please sign in to comment.