Permalink
Browse files

Checkboxradio: Escape ID when it is being used as a selector for nett…

…ing the corresponding <label>. Fixes #6052 - version 1.3.0 checkboxes are not displayed when id has [ character - selectors not escaped properly.
  • Loading branch information...
gabrielschulhof committed Aug 13, 2013
1 parent 5cc2162 commit 0b4e538d0a0256d9b01cf4e158ce8d640deead5b
Showing with 9 additions and 3 deletions.
  1. +9 −3 js/widgets/forms/checkboxradio.js
@@ -32,12 +32,18 @@ $.widget( "mobile.checkboxradio", $.extend( {
var input = this.element,
o = this.options,
inheritAttr = function( input, dataAttr ) {
return input.jqmData( dataAttr ) || input.closest( "form, fieldset" ).jqmData( dataAttr );
return input.jqmData( dataAttr ) ||
input.closest( "form, fieldset" ).jqmData( dataAttr );
},
// NOTE: Windows Phone could not find the label through a selector
// filter works though.
parentLabel = $( input ).closest( "label" ),
label = parentLabel.length ? parentLabel : $( input ).closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" ).find( "label" ).filter( "[for='" + input[0].id + "']" ).first(),
parentLabel = input.closest( "label" ),
label = parentLabel.length ? parentLabel :
input
.closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" )
.find( "label" )
.filter( "[for='" + $.mobile.path.hashToSelector( input[0].id ) + "']" )
.first(),
inputtype = input[0].type,
checkedState = inputtype + "-on",
uncheckedState = inputtype + "-off",

0 comments on commit 0b4e538

Please sign in to comment.