Permalink
Browse files

Custom select: Escape weird characters in popup/dialog ID when they b…

…ecome hrefs. Fixes #5893.
  • Loading branch information...
gabrielschulhof committed Apr 17, 2013
1 parent 541f963 commit f0b2417d4d8cbd84903fe9c1112a34b1ef13a039
Showing with 6 additions and 3 deletions.
  1. +6 −3 js/widgets/forms/select.custom.js
@@ -98,7 +98,10 @@ define( [
placeholder: "",
build: function() {
var self = this;
var self = this,
escapeId = function( id ) {
return id.replace( /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g, "\\$1" );
}
// Create list from select, update state
self.refresh();
@@ -128,9 +131,9 @@ define( [
self._decideFormat();
if ( self.menuType === "overlay" ) {
self.button.attr( "href", "#" + self.popupID ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "popup" );
self.button.attr( "href", "#" + escapeId( self.popupID ) ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "popup" );
} else {
self.button.attr( "href", "#" + self.dialogID ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "dialog" );
self.button.attr( "href", "#" + escapeId( self.dialogID ) ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "dialog" );
}
self.isOpen = true;
// Do not prevent default, so the navigation may have a chance to actually open the chosen format

0 comments on commit f0b2417

Please sign in to comment.