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

Commit c7dd675

Browse files
Checkboxradio: Allow to set option mini programmatically. Fixes #4070.
1 parent 6e1194b commit c7dd675

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

js/widgets/forms/checkboxradio.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", ".
1616
$.widget( "mobile.checkboxradio", $.mobile.widget, {
1717
options: {
1818
theme: null,
19+
mini: false,
1920
initSelector: "input[type='checkbox'],input[type='radio']"
2021
},
2122
_create: function() {
2223
var self = this,
2324
input = this.element,
25+
o = this.options,
2426
inheritAttr = function( input, dataAttr ) {
2527
return input.jqmData( dataAttr ) || input.closest( "form, fieldset" ).jqmData( dataAttr );
2628
},
@@ -29,7 +31,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
2931
parentLabel = $( input ).closest( "label" ),
3032
label = parentLabel.length ? parentLabel : $( input ).closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" ).find( "label" ).filter( "[for='" + input[0].id + "']" ).first(),
3133
inputtype = input[0].type,
32-
mini = inheritAttr( input, "mini" ),
34+
mini = inheritAttr( input, "mini" ) || o.mini,
3335
checkedState = inputtype + "-on",
3436
uncheckedState = inputtype + "-off",
3537
icon = input.parents( ":jqmData(type='horizontal')" ).length ? undefined : uncheckedState,
@@ -55,12 +57,12 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
5557
});
5658

5759
// If there's no selected theme check the data attr
58-
if ( !this.options.theme ) {
59-
this.options.theme = $.mobile.getInheritedTheme( this.element, "c" );
60+
if ( !o.theme ) {
61+
o.theme = $.mobile.getInheritedTheme( this.element, "c" );
6062
}
6163

6264
label.buttonMarkup({
63-
theme: this.options.theme,
65+
theme: o.theme,
6466
icon: icon,
6567
shadow: false,
6668
mini: mini,

0 commit comments

Comments
 (0)