]> source.dussan.org Git - jquery-ui.git/commitdiff
Button: Adding quotes to the attribute selector for labels - Fixes #7534 - Button...
authorCorey Frang <gnarf@gnarf.net>
Thu, 4 Aug 2011 03:19:29 +0000 (22:19 -0500)
committerCorey Frang <gnarf@gnarf.net>
Thu, 4 Aug 2011 03:19:29 +0000 (22:19 -0500)
(cherry picked from commit 065aef537b7533046907fcffc6896949e44679eb)

Conflicts:

ui/jquery.ui.button.js

tests/unit/button/button_tickets.js
ui/jquery.ui.button.js

index 9a7ccae43127322fc51ffd0e6bb5ee102b51a3a0..83148db902491173c6483b8df2dca8b5f2575403 100644 (file)
@@ -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 );
index 2fac87cea5ab6f0f940fd8cdf2e05ed338c9ac07..f7c7486e622002d2ac907eafa4a2999710c8f9fd 100644 (file)
@@ -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();