make sure first textnode of li is used in listview title, regardless of newline chars. Test included. Fixes #715

This commit is contained in:
scottjehl 2011-01-20 17:48:44 -05:00
parent bfa6f6a3af
commit 52f86f2f9a
3 changed files with 10 additions and 2 deletions

View file

@ -300,7 +300,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
$( parentList.find( "ul, ol" ).toArray().reverse() ).each(function( i ) {
var list = $( this ),
parent = list.parent(),
title = $.trim(parent.contents()[ 0 ].nodeValue.split("\n")[0]) || parent.find('a:first').text(),
title = $.trim(parent.contents()[ 0 ].nodeValue) || parent.find('a:first').text(),
id = parentId + "&" + $.mobile.subPageUrlKey + "=" + self._idStringEscape(title + " " + i),
theme = list.data( "theme" ) || o.theme,
countTheme = list.data( "counttheme" ) || parentList.data( "counttheme" ) || o.countTheme,

View file

@ -68,7 +68,11 @@
<li>troop of baboons</li>
</ul>
</li>
<li>More animals
<li class="linebreaknode">
More animals
<ul>
<li>Shoal of Bass</li>
<li>Rhumba of rattlesnakes</li>

View file

@ -62,6 +62,10 @@
start();
}, 1000);
})
test( "nested list title should use first text node, regardless of line breaks", function(){
ok($('#nested-list-test .linebreaknode').text() === "More animals", 'Text should be "More animals"');
});
module('Ordered Lists')