Skip to content
This repository
Browse code

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

…. Thx for the logic suggestion, @eugenb1. Fixes #1996.
  • Loading branch information...
commit e567742c90e3c4bd5423298c4d714e92867f1d8e 1 parent 4703fe0
authored July 10, 2011

Showing 1 changed file with 15 additions and 8 deletions. Show diff stats Hide diff stats

  1. 23  js/jquery.mobile.listview.js
23  js/jquery.mobile.listview.js
@@ -49,13 +49,20 @@ $.widget( "mobile.listview", $.mobile.widget, {
49 49
 	},
50 50
 
51 51
 	_removeCorners: function( li, which ) {
52  
-		which = which || [ "top", "bottom" ];
53  
-		var classes = {
54  
-			top: "ui-corner-top ui-corner-tr ui-corner-tl",
55  
-			bottom: "ui-corner-bottom ui-corner-br ui-corner-bl"
56  
-		};
57  
-		li.add( li.find( ".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb" ) )
58  
-			.removeClass( "ui-corner-top ui-corner-bottom ui-corner-br ui-corner-bl ui-corner-tr ui-corner-tl" );
  52
+		var top = "ui-corner-top ui-corner-tr ui-corner-tl",
  53
+			bot = "ui-corner-bottom ui-corner-br ui-corner-bl";
  54
+		
  55
+		li = li.add( li.find( ".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb" ) );
  56
+		
  57
+		if ( which === "top" ) {
  58
+			li.removeClass( top );
  59
+		}
  60
+		else if ( which === "bottom"  ) {
  61
+			li.removeClass( bot );
  62
+		}
  63
+		else {
  64
+			li.removeClass( top + " " + bot );
  65
+		}
59 66
 	},
60 67
 
61 68
 	refresh: function( create ) {
@@ -171,7 +178,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
171 178
 					if ( item.prev().prev().length ) {
172 179
 						self._removeCorners( item.prev() );
173 180
 					} else if ( item.prev().length ) {
174  
-						self._removeCorners( item.prev(), ["bottom"] );
  181
+						self._removeCorners( item.prev(), "bottom" );
175 182
 					}
176 183
 				}
177 184
 			}

0 notes on commit e567742

Please sign in to comment.
Something went wrong with that request. Please try again.