mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-13 17:13:10 +00:00
create getEncodedText helper and update custom select for use Fixes #2547
This commit is contained in:
parent
3a337e98c7
commit
ac0288a5ba
2 changed files with 9 additions and 2 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue