diff options
author | Corey Frang <gnarf@gnarf.net> | 2011-08-03 22:19:29 -0500 |
---|---|---|
committer | Corey Frang <gnarf@gnarf.net> | 2011-08-03 22:19:29 -0500 |
commit | 07d5271f7eac17a1a732b562b836b12a889e3b60 (patch) | |
tree | 0b27ac477fc20f949f728eff7300a3936efc2a9b | |
parent | 14ab4f4f374ddda1eaa552072e6e3a86a91db4bd (diff) | |
download | jquery-ui-07d5271f7eac17a1a732b562b836b12a889e3b60.tar.gz jquery-ui-07d5271f7eac17a1a732b562b836b12a889e3b60.zip |
Button: Adding quotes to the attribute selector for labels - Fixes #7534 - Button label selector omits quotes / fails for ids with ":"
(cherry picked from commit 065aef537b7533046907fcffc6896949e44679eb)
Conflicts:
ui/jquery.ui.button.js
-rw-r--r-- | tests/unit/button/button_tickets.js | 6 | ||||
-rw-r--r-- | ui/jquery.ui.button.js | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/unit/button/button_tickets.js b/tests/unit/button/button_tickets.js index 9a7ccae43..83148db90 100644 --- a/tests/unit/button/button_tickets.js +++ b/tests/unit/button/button_tickets.js @@ -50,4 +50,10 @@ test( "#7092 - button creation that requires a matching label does not find labe ok( group.find( "label" ).is( ".ui-button" ) ); }); +test( "#7534 - Button label selector works for ids with \":\"", function() { + var group = $( "<span><input type='checkbox' id='check:7534'><label for='check:7534'>Label</label></span>" ); + group.find( "input" ).button(); + ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" ); +}); + })( jQuery ); diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 2fac87cea..f7c7486e6 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -227,7 +227,7 @@ $.widget( "ui.button", { // we don't search against the document in case the element // is disconnected from the DOM var ancestor = this.element.parents().filter(":last"), - labelSelector = "label[for=" + this.element.attr("id") + "]"; + labelSelector = "label[for='" + this.element.attr("id") + "']"; this.buttonElement = ancestor.find( labelSelector ); if ( !this.buttonElement.length ) { ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); |