From e567742c90e3c4bd5423298c4d714e92867f1d8e Mon Sep 17 00:00:00 2001 From: scottjehl Date: Sun, 10 Jul 2011 18:07:12 -0400 Subject: [PATCH] fixed up logic and code style for the _removeCorners "which" argument. Thx for the logic suggestion, @eugenb1. Fixes #1996. --- js/jquery.mobile.listview.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/js/jquery.mobile.listview.js b/js/jquery.mobile.listview.js index c2fc9aec..d7626bb6 100644 --- a/js/jquery.mobile.listview.js +++ b/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" ); } } }