Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Checkboxradio: Retrieve form ID via .getAttribute() #7224

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/widgets/forms/checkboxradio.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ $.widget( "mobile.checkboxradio", $.extend( {

// If we're inside a form
if ( form ) {
formId = form.id;
formId = form.getAttribute( "id" );

// If the form has an ID, collect radios scattered throught the document which
// nevertheless are part of the form by way of the value of their form attribute
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/checkboxradio/input-set-tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
<div data-nstest-role="page">
<label>Radio<input id="radio:1" type="radio" name="group1"></label>
<form id="the-[form]">
<!--
https://github.com/jquery/jquery-mobile/issues/7223
Adding the below hidden input will cause code that accesses the form attribute via
form.id to return this input, rather than the ID of the form. The presence of this
input constitutes a test against that kind of code. The correct way to retrieve the
id of a form is form.getAttribute( "id" ).
-->
<input type="hidden" name="id" value="">
<label>Radio<input id="radio:2" type="radio" name="group1"></label>
<label>Radio<input id="radio:7" type="radio" name="group1" form="the-'other'-form"></label>
</form>
Expand Down