Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…ecome hrefs. Fixes #5893.

(cherry picked from commit f0b2417)
  • Loading branch information...
commit 83e14b92d89031db9b7ed98c4fa2ad21524821b6 1 parent 3d4108d
@gabrielschulhof gabrielschulhof authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 js/widgets/forms/select.custom.js
View
9 js/widgets/forms/select.custom.js
@@ -99,7 +99,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();
@@ -129,9 +132,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
Please sign in to comment.
Something went wrong with that request. Please try again.