moved the ID creation string escape function from core to listview. No other plugins use it.

This commit is contained in:
scottjehl 2010-11-19 23:21:16 -05:00
parent ba5fea7f1e
commit a0596434bc

View file

@ -279,6 +279,11 @@ $.widget( "mobile.listview", $.mobile.widget, {
});
},
//create a string for ID/subpage url creation
_idStringEscape: function( str ){
return str.replace(/[^a-zA-Z0-9]/g, '-');
},
_createSubPages: function() {
var parentList = this.element,
parentPage = parentList.closest( ".ui-page" ),
@ -290,7 +295,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
var list = $( this ),
parent = list.parent(),
title = parent.contents()[ 0 ].nodeValue.split("\n")[0],
id = parentId + "&" + $.mobile.subPageUrlKey + "=" + $.mobile.idStringEscape(title + " " + i),
id = parentId + "&" + $.mobile.subPageUrlKey + "=" + self.idStringEscape(title + " " + i),
theme = list.data( "theme" ) || o.theme,
countTheme = list.data( "counttheme" ) || parentList.data( "counttheme" ) || o.countTheme,
newPage = list.wrap( "<div data-role='page'><div data-role='content'></div></div>" )