Permalink
Browse files

Button: Ignore non-radio elements with the same name

Fixes #8761
Closes gh-1185
  • Loading branch information...
tjvantoll committed Jan 28, 2014
1 parent fa23894 commit ccb13240dd8b5cfac0199a30dcec4a71cbe1b252
Showing with 16 additions and 2 deletions.
  1. +14 −0 tests/unit/button/button_core.js
  2. +2 −2 ui/button.js
@@ -53,6 +53,20 @@ test("radio groups", function() {
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() {
expect( 2 );
var input = $("#submit");
View
@@ -40,9 +40,9 @@ var lastActive,
if ( name ) {
name = name.replace( /'/g, "\\'" );
if ( form ) {
radios = $( form ).find( "[name='" + name + "']" );
radios = $( form ).find( "[name='" + name + "'][type=radio]" );
} else {
radios = $( "[name='" + name + "']", radio.ownerDocument )
radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
.filter(function() {
return !this.form;
});

0 comments on commit ccb1324

Please sign in to comment.