Skip to content
This repository
Browse code

Checkboxradio: Allow to set option mini programmatically. Fixes #4070.

  • Loading branch information...
commit 320cbf4008b78c4da5ea4761edc85cce295ef239 1 parent 26cb01f
Jasper de Groot authored November 08, 2012

Showing 1 changed file with 6 additions and 4 deletions. Show diff stats Hide diff stats

  1. 10  js/widgets/forms/checkboxradio.js
10  js/widgets/forms/checkboxradio.js
@@ -16,11 +16,13 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", ".
16 16
 $.widget( "mobile.checkboxradio", $.mobile.widget, {
17 17
 	options: {
18 18
 		theme: null,
  19
+		mini: false,
19 20
 		initSelector: "input[type='checkbox'],input[type='radio']"
20 21
 	},
21 22
 	_create: function() {
22 23
 		var self = this,
23 24
 			input = this.element,
  25
+			o = this.options,
24 26
 			inheritAttr = function( input, dataAttr ) {
25 27
 				return input.jqmData( dataAttr ) || input.closest( "form, fieldset" ).jqmData( dataAttr );
26 28
 			},
@@ -29,7 +31,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
29 31
 			parentLabel = $( input ).closest( "label" ),
30 32
 			label = parentLabel.length ? parentLabel : $( input ).closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" ).find( "label" ).filter( "[for='" + input[0].id + "']" ).first(),
31 33
 			inputtype = input[0].type,
32  
-			mini = inheritAttr( input, "mini" ),
  34
+			mini = inheritAttr( input, "mini" ) || o.mini,
33 35
 			checkedState = inputtype + "-on",
34 36
 			uncheckedState = inputtype + "-off",
35 37
 			icon = input.parents( ":jqmData(type='horizontal')" ).length ? undefined : uncheckedState,
@@ -55,12 +57,12 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
55 57
 		});
56 58
 
57 59
 		// 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" );
60 62
 		}
61 63
 
62 64
 		label.buttonMarkup({
63  
-			theme: this.options.theme,
  65
+			theme: o.theme,
64 66
 			icon: icon,
65 67
 			shadow: false,
66 68
 			mini: mini,

0 notes on commit 320cbf4

Please sign in to comment.
Something went wrong with that request. Please try again.