mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-12-07 06:14:24 +00:00
Button: Ignore non-radio elements with the same name
Fixes #8761 Closes gh-1185
This commit is contained in:
parent
fa23894dff
commit
ccb13240dd
@ -53,6 +53,20 @@ test("radio groups", function() {
|
|||||||
assert(":eq(1)", ":eq(0)", ":eq(0)");
|
assert(":eq(1)", ":eq(0)", ":eq(0)");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( "radio groups - ignore elements with same name", function() {
|
||||||
|
expect( 1 );
|
||||||
|
var form = $( "form:first" ),
|
||||||
|
radios = form.find( "[type=radio]" ).button(),
|
||||||
|
checkbox = $( "<input>", {
|
||||||
|
type: "checkbox",
|
||||||
|
name: radios.attr( "name" )
|
||||||
|
});
|
||||||
|
|
||||||
|
form.append( checkbox );
|
||||||
|
radios.button( "refresh" );
|
||||||
|
ok( true, "no exception from accessing button instance of checkbox" );
|
||||||
|
});
|
||||||
|
|
||||||
test("input type submit, don't create child elements", function() {
|
test("input type submit, don't create child elements", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var input = $("#submit");
|
var input = $("#submit");
|
||||||
|
@ -40,9 +40,9 @@ var lastActive,
|
|||||||
if ( name ) {
|
if ( name ) {
|
||||||
name = name.replace( /'/g, "\\'" );
|
name = name.replace( /'/g, "\\'" );
|
||||||
if ( form ) {
|
if ( form ) {
|
||||||
radios = $( form ).find( "[name='" + name + "']" );
|
radios = $( form ).find( "[name='" + name + "'][type=radio]" );
|
||||||
} else {
|
} else {
|
||||||
radios = $( "[name='" + name + "']", radio.ownerDocument )
|
radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
|
||||||
.filter(function() {
|
.filter(function() {
|
||||||
return !this.form;
|
return !this.form;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user