var listCountPerPage = {}; $.mobile.listview.prototype._createSubPages = function() { var parentList = this.element, parentPage = parentList.closest( ".ui-page" ), parentUrl = parentPage.jqmData( "url" ), parentId = parentUrl || parentPage[ 0 ][ $.expando ], parentListId = parentList.attr( "id" ), o = this.options, dns = "data-" + $.mobile.ns, self = this, persistentFooterID = parentPage.find( ":jqmData(role='footer')" ).jqmData( "id" ), hasSubPages; if ( typeof listCountPerPage[ parentId ] === "undefined" ) { listCountPerPage[ parentId ] = -1; } parentListId = parentListId || ++listCountPerPage[ parentId ]; $( parentList.find( "li>ul, li>ol" ).toArray().reverse() ).each(function( i ) { var self = this, list = $( this ), listId = list.attr( "id" ) || parentListId + "-" + i, parent = list.parent(), nodeElsFull = $( list.prevAll().toArray().reverse() ), nodeEls = nodeElsFull.length ? nodeElsFull : $( "" + $.trim(parent.contents()[ 0 ].nodeValue) + "" ), title = nodeEls.first().getEncodedText(),//url limits to first 30 chars of text id = ( parentUrl || "" ) + "&" + $.mobile.subPageUrlKey + "=" + listId, theme = list.jqmData( "theme" ) || o.theme, countTheme = list.jqmData( "counttheme" ) || parentList.jqmData( "counttheme" ) || o.countTheme, newPage, anchor; //define hasSubPages for use in later removal hasSubPages = true; // This function creates pages with a new header following the 'b' theme. var dynamicPages = function (lv) { return lv.detach() .wrap("
") .parent() .before("
" + title + "
") .after(persistentFooterID ? $("
") : "") .parent() .appendTo($.mobile.pageContainer); }; // This function clones the header and footer of the parent page. var clonedPages = function (lv) { return lv.detach() .wrap("
") .parent() .before(parentPage.find(":jqmData(role='header')").clone(true)) .after(parentPage.find(":jqmData(role='footer')").clone(true)) .parent() .appendTo($.mobile.pageContainer); }; // Set the data-dynamic attribute on the parent list (