made sure data-icon attrs work on radio and checks. Fixes #423, Fixes #424

This commit is contained in:
scottjehl 2010-11-10 23:19:41 -05:00
parent bf3730550f
commit 563169def9
2 changed files with 11 additions and 13 deletions

View file

@ -56,10 +56,10 @@
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<legend>Choose a pet:</legend>
<input type="radio" name="radio-pet-1" id="radio-pet-1" value="choice-1" checked="checked" data-theme="a" />
<input type="radio" name="radio-pet-1" id="radio-pet-1" value="choice-1" checked="checked" />
<label for="radio-pet-1">Cat</label>
<input type="radio" name="radio-pet-1" id="radio-pet-2" value="choice-2" data-theme="a" />
<input type="radio" name="radio-pet-1" id="radio-pet-2" value="choice-2" />
<label for="radio-pet-2">Dog</label>
<input type="radio" name="radio-pet-1" id="radio-pet-3" value="choice-3" />
@ -83,11 +83,11 @@
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-type="horizontal">
<legend>Layout view:</legend>
<input type="radio" name="radio-view" id="radio-view-a" value="list" data-icon="false" />
<input type="radio" name="radio-view" id="radio-view-a" value="list" />
<label for="radio-view-a">List</label>
<input type="radio" name="radio-view" id="radio-view-b" value="grid" data-icon="false" />
<input type="radio" name="radio-view" id="radio-view-b" value="grid" />
<label for="radio-view-b">Grid</label>
<input type="radio" name="radio-view" id="radio-view-c" value="gallery" data-icon="false" />
<input type="radio" name="radio-view" id="radio-view-c" value="gallery" />
<label for="radio-view-c">Gallery</label>
</fieldset>
</div>
@ -95,16 +95,16 @@
<!--
<h2>No icon option</h2>
<p>If you don't want the default radiobutton icon to be added, add the <code>data-icon="false"</code> attribute to each radio <code>input</code>. </p>
<p>If you don't want the default radiobutton icon to be added, add the <code></code> attribute to each radio <code>input</code>. </p>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<legend>These don't have the radio state icons:</legend>
<input type="radio" name="radio-noicon" id="radio-noicon1" value="a" data-icon="false" checked="checked" />
<input type="radio" name="radio-noicon" id="radio-noicon1" value="a" checked="checked" />
<label for="radio-noicon1">Yes</label>
<input type="radio" name="radio-noicon" id="radio-noicon2" value="b" data-icon="false" />
<input type="radio" name="radio-noicon" id="radio-noicon2" value="b" />
<label for="radio-noicon2">No</label>
<input type="radio" name="radio-noicon" id="radio-noicon3" value="c" data-icon="false" />
<input type="radio" name="radio-noicon" id="radio-noicon3" value="c" />
<label for="radio-noicon3">Maybe</label>
</fieldset>
</div>

View file

@ -7,8 +7,7 @@
(function ( $ ) {
$.widget( "mobile.checkboxradio", $.mobile.widget, {
options: {
theme: undefined,
icon: undefined
theme: null
},
_create: function(){
var input = this.element,
@ -21,9 +20,8 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
label
.buttonMarkup({
iconpos: this.options.icon,
theme: this.options.theme,
icon: this.options.icon ? uncheckedicon : ( this.element.parents( "[data-type='horizontal']" ).length ? undefined : uncheckedicon ),
icon: this.element.parents( "[data-type='horizontal']" ).length ? undefined : uncheckedicon,
shadow: false
});