mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-19 13:51:00 +00:00
make sure first textnode of li is used in listview title, regardless of newline chars. Test included. Fixes #715
This commit is contained in:
parent
bfa6f6a3af
commit
52f86f2f9a
3 changed files with 10 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue