mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Button: Adding quotes to the attribute selector for labels - Fixes #7534 - Button label selector omits quotes / fails for ids with ":"
(cherry picked from commit 065aef537b
)
Conflicts:
ui/jquery.ui.button.js
This commit is contained in:
parent
14ab4f4f37
commit
07d5271f7e
@ -50,4 +50,10 @@ test( "#7092 - button creation that requires a matching label does not find labe
|
|||||||
ok( group.find( "label" ).is( ".ui-button" ) );
|
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 );
|
})( jQuery );
|
||||||
|
2
ui/jquery.ui.button.js
vendored
2
ui/jquery.ui.button.js
vendored
@ -227,7 +227,7 @@ $.widget( "ui.button", {
|
|||||||
// we don't search against the document in case the element
|
// we don't search against the document in case the element
|
||||||
// is disconnected from the DOM
|
// is disconnected from the DOM
|
||||||
var ancestor = this.element.parents().filter(":last"),
|
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 );
|
this.buttonElement = ancestor.find( labelSelector );
|
||||||
if ( !this.buttonElement.length ) {
|
if ( !this.buttonElement.length ) {
|
||||||
ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
|
ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
|
||||||
|
Loading…
Reference in New Issue
Block a user