Skip to content
This repository
Browse code

split list icons should prefer second link, list item, and then the w…

…hole list config Fixes #3775
  • Loading branch information...
commit 30a8322bfe7c9aada99745c579039fed37fb758f 1 parent 054b9a4
John Bender authored March 09, 2012
6  js/jquery.mobile.listview.js
@@ -158,7 +158,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
158 158
 			counter = $.support.cssPseudoElement || !$.nodeName( $list[ 0 ], "ol" ) ? 0 : 1,
159 159
 			itemClassDict = {},
160 160
 			item, itemClass, itemTheme,
161  
-			a, last, splittheme, countParent, icon, imgParents, img;
  161
+			a, last, splittheme, countParent, icon, imgParents, img, linkIcon;
162 162
 
163 163
 		if ( counter ) {
164 164
 			$list.find( ".ui-li-dec" ).remove();
@@ -200,6 +200,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
200 200
 
201 201
 						last = a.last();
202 202
 						splittheme = listsplittheme || last.jqmData( "theme" ) || o.splitTheme;
  203
+						linkIcon = last.jqmData("icon");
203 204
 
204 205
 						last.appendTo(item)
205 206
 							.attr( "title", last.getEncodedText() )
@@ -219,7 +220,8 @@ $.widget( "mobile.listview", $.mobile.widget, {
219 220
 										corners: true,
220 221
 										theme: splittheme,
221 222
 										iconpos: "notext",
222  
-										icon: icon || listspliticon || o.splitIcon
  223
+										// link icon overrides list item icon overrides ul element overrides options
  224
+										icon: linkIcon || icon || listspliticon || o.splitIcon
223 225
 									})
224 226
 								);
225 227
 					}
5  tests/unit/listview/index.html
@@ -350,13 +350,14 @@ <h2 id="qunit-userAgent"></h2>
350 350
 
351 351
 <div data-nstest-role="page" id="split-list-icon">
352 352
 	<div data-nstest-role="content">
353  
-		<ul data-nstest-role="listview">
  353
+		<ul data-nstest-role="listview" data-nstest-split-icon="delete">
354 354
 			<li data-nstest-icon="star"><a href="#">Star</a><a href="#">Star</a></li>
355 355
 			<li data-nstest-icon="plug"><a href="#">Plus</a><a href="#">Plus</a></li>
356 356
 			<li><a href="#">Default</a><a href="#">Default</a></li>
  357
+      <!-- respect the child element icon -->
  358
+			<li data-nstest-icon="star"><a href="#">Default</a><a data-nstest-icon="plug" href="#">Default</a></li>
357 359
 		</ul>
358 360
 	</div>
359 361
 </div>
360  
-
361 362
 </body>
362 363
 </html>
6  tests/unit/listview/listview_core.js
@@ -842,10 +842,9 @@
842 842
 			function() {
843 843
 				$.mobile.activePage.find("li").each(function(i, elem){
844 844
 					var $elem = $(elem),
845  
-						icon = $elem.jqmData( "icon" ),
846  
-						order = [ "star", "plug", "arrow-r" ];
  845
+						order = [ "star", "plug", "delete", "plug" ];
847 846
 
848  
-					same( $elem.find("span.ui-icon-" + order[i]).length, 1, "there should be one " + icon + " icon" );
  847
+					same( $elem.find("span.ui-icon-" + order[i]).length, 1, "there should be one " + order[i] + " icon" );
849 848
 				});
850 849
 
851 850
 				window.history.back();
@@ -854,5 +853,4 @@
854 853
 			start
855 854
 		]);
856 855
 	});
857  
-
858 856
 })(jQuery);

0 notes on commit 30a8322

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