create getEncodedText helper and update custom select for use Fixes #2547

This commit is contained in:
John Bender 2011-09-27 15:19:35 -07:00
parent 3a337e98c7
commit ac0288a5ba
2 changed files with 9 additions and 2 deletions

View file

@ -172,6 +172,13 @@
$(elem).jqmData( 'dependents', $.merge(dependents, newDependents) );
};
// note that this helper doesn't attempt to handle the callback
// or setting of an html elements text, its only purpose is
// to return the html encoded version of the text in all cases. (thus the name)
$.fn.getEncodedText = function() {
return $( "<div/>" ).text( $(this).text() ).html();
};
// Monkey-patching Sizzle to filter the :jqmData selector
var oldFind = $.find;

View file

@ -19,7 +19,7 @@
menuId = selectID + "-menu",
menuPage = $( "<div data-" + $.mobile.ns + "role='dialog' data-" +$.mobile.ns + "theme='"+ widget.options.menuPageTheme +"'>" +
"<div data-" + $.mobile.ns + "role='header'>" +
"<div class='ui-title'>" + label.text() + "</div>"+
"<div class='ui-title'>" + label.getEncodedText() + "</div>"+
"</div>"+
"<div data-" + $.mobile.ns + "role='content'></div>"+
"</div>" ).appendTo( $.mobile.pageContainer ).page(),
@ -414,7 +414,7 @@
self.select.find( "option" ).each( function( i ) {
var $this = $( this ),
$parent = $this.parent(),
text = $this.text(),
text = $this.getEncodedText(),
anchor = "<a href='#'>"+ text +"</a>",
classes = [],
extraAttrs = [];