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

Commit

Permalink
Checkboxradio: Retrieve form ID via .getAttribute()
Browse files Browse the repository at this point in the history
Closes gh-7224
Fixes gh-7223
  • Loading branch information
Gabriel Schulhof committed Mar 12, 2014
1 parent a9d37be commit 9ff610d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/widgets/forms/checkboxradio.js
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
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

0 comments on commit 9ff610d

Please sign in to comment.