diff --git a/js/jquery.mobile.core.js b/js/jquery.mobile.core.js index cf2c52c0..e8f2faca 100644 --- a/js/jquery.mobile.core.js +++ b/js/jquery.mobile.core.js @@ -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 $( "
" ).text( $(this).text() ).html(); + }; + // Monkey-patching Sizzle to filter the :jqmData selector var oldFind = $.find; diff --git a/js/jquery.mobile.forms.select.custom.js b/js/jquery.mobile.forms.select.custom.js index 12054d8c..0a54f134 100644 --- a/js/jquery.mobile.forms.select.custom.js +++ b/js/jquery.mobile.forms.select.custom.js @@ -19,7 +19,7 @@ menuId = selectID + "-menu", menuPage = $( "
" + "
" + - "
" + label.text() + "
"+ + "
" + label.getEncodedText() + "
"+ "
"+ "
"+ "
" ).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 = ""+ text +"", classes = [], extraAttrs = [];