aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2012-11-19 08:37:41 -0500
committerMike Sherov <mike.sherov@gmail.com>2012-11-19 08:37:41 -0500
commitcc7df712cc4ca90f6d6db599c5ff91b690921581 (patch)
tree5cb37de0e5e6aac4163a543fc0fb6253ac82c42e
parent4334b5d4f1113ef751cb6738d8b2a60467a700e4 (diff)
downloadjquery-ui-cc7df712cc4ca90f6d6db599c5ff91b690921581.tar.gz
jquery-ui-cc7df712cc4ca90f6d6db599c5ff91b690921581.zip
Button: properly escape button names. Fixes #7505 - Button: Buttonset not applied to radio group with quotation/apostrophe in name.
-rw-r--r--tests/unit/button/button.html7
-rw-r--r--tests/unit/button/button_events.js10
-rw-r--r--ui/jquery.ui.button.js1
3 files changed, 17 insertions, 1 deletions
diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html
index b79ca1dc6..93f9af611 100644
--- a/tests/unit/button/button.html
+++ b/tests/unit/button/button.html
@@ -59,6 +59,13 @@
<input type="radio" id="radio23" name="radio" checked="checked"><label for="radio23">Choice 3</label>
</div>
</form>
+<form>
+ <div id="radio3">
+ <input type="radio" id="radio31" name="data['Page']['parse']" /><label for="radio31">Choice 1</label>
+ <input type="radio" id="radio32" name="data['Page']['parse']" checked="checked" /><label for="radio32">Choice 2</label>
+ <input type="radio" id="radio33" name="data['Page']['parse']" /><label for="radio33">Choice 3</label>
+ </div>
+</form>​
<input type="checkbox" id="check"><label for="check">Toggle</label>
diff --git a/tests/unit/button/button_events.js b/tests/unit/button/button_events.js
index 40d2a1a96..ad83101d0 100644
--- a/tests/unit/button/button_events.js
+++ b/tests/unit/button/button_events.js
@@ -1,8 +1,16 @@
/*
* button_events.js
*/
-(function() {
+(function($) {
module("button: events");
+test("buttonset works with single-quote named elements (#7505)", function() {
+ expect( 1 );
+ $("#radio3").buttonset();
+ $("#radio33").click( function(){
+ ok( true, "button clicks work with single-quote named elements" );
+ }).click();
+});
+
})(jQuery);
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index db04b63b8..508a0424a 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -29,6 +29,7 @@ var lastActive, startXPos, startYPos, clickDragged,
form = radio.form,
radios = $( [] );
if ( name ) {
+ name = name.replace( /'/g, "\\'" );
if ( form ) {
radios = $( form ).find( "[name='" + name + "']" );
} else {