fixed up logic and code style for the _removeCorners "which" argument. Thx for the logic suggestion, @eugenb1. Fixes #1996.

This commit is contained in:
scottjehl 2011-07-10 18:07:12 -04:00
parent 4703fe0d24
commit e567742c90

View file

@ -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" );
}
}
}