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

Commit

Permalink
Select: Add mini and inline classes to container. Set margin on the c…
Browse files Browse the repository at this point in the history
…ontainer. Fixes #5838.
  • Loading branch information
jaspermdegroot committed May 8, 2013
1 parent 10348e7 commit f6624ac
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
24 changes: 13 additions & 11 deletions css/structure/jquery.mobile.controlgroup.css
Expand Up @@ -8,6 +8,19 @@ fieldset.ui-controlgroup {
.ui-field-contain fieldset.ui-controlgroup {
margin: 0;
}
.ui-controlgroup .ui-btn,
.ui-controlgroup .ui-checkbox,
.ui-controlgroup .ui-radio,
.ui-controlgroup .ui-select {
margin: 0;
}
.ui-controlgroup .ui-btn:focus,
.ui-controlgroup .ui-btn.ui-focus {
z-index: 1;
}
.ui-controlgroup li {
list-style: none;
}
.ui-controlgroup-horizontal .ui-controlgroup-controls {
display: inline-block;
vertical-align: middle;
Expand All @@ -28,17 +41,6 @@ fieldset.ui-controlgroup {
.ui-controlgroup-horizontal .ui-select {
float: left;
clear: none;
margin: 0;
}
.ui-controlgroup .ui-btn {
margin: 0;
}
.ui-controlgroup .ui-btn:focus,
.ui-controlgroup .ui-btn.ui-focus {
z-index: 1;
}
.ui-controlgroup li {
list-style: none;
}
.ui-controlgroup-horizontal button.ui-btn,
.ui-controlgroup .ui-btn-icon-notext {
Expand Down
3 changes: 2 additions & 1 deletion css/structure/jquery.mobile.forms.select.css
@@ -1,5 +1,5 @@
.ui-select {
display: block;
margin: .5em 0;
position: relative;
}
.ui-select > select {
Expand All @@ -13,6 +13,7 @@
clip: rect(1px,1px,1px,1px);
}
.ui-select .ui-btn {
margin: 0;
opacity: 1; /* Fixes #2588: When Windows Phone 7.5 (Mango) tries to calculate a numeric opacity for a select (including "inherit") without explicitly specifying an opacity on the parent to give it context, a bug appears where clicking elsewhere on the page after opening the select will open the select again. */
}
.ui-select .ui-btn select {
Expand Down
17 changes: 11 additions & 6 deletions js/widgets/forms/select.js
Expand Up @@ -53,7 +53,9 @@ $.widget( "mobile.selectmenu", $.mobile.widget, $.extend( {

// setup items that are generally necessary for select menu extension
_preExtension: function() {
var classes = "";
var inline = this.options.inline || this.element.jqmData( "inline" ),
mini = this.options.mini || this.element.jqmData( "mini" ),
classes = "";
// TODO: Post 1.1--once we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577
/* if ( $el[0].className.length ) {
classes = $el[0].className;
Expand All @@ -66,6 +68,13 @@ $.widget( "mobile.selectmenu", $.mobile.widget, $.extend( {
classes = " ui-btn-right";
}

if ( inline ) {
classes += " ui-btn-inline";
}
if ( mini ) {
classes += " ui-mini";
}

this.select = this.element.removeClass( "ui-btn-left ui-btn-right" ).wrap( "<div class='ui-select" + classes + "'>" );
this.selectID = this.select.attr( "id" );
this.label = $( "label[for='"+ this.selectID +"']" );
Expand Down Expand Up @@ -100,8 +109,6 @@ $.widget( "mobile.selectmenu", $.mobile.widget, $.extend( {

options = this.options,

inline = options.inline || this.select.jqmData( "inline" ),
mini = options.mini || this.select.jqmData( "mini" ),
iconpos = options.icon ? ( options.iconpos || this.select.jqmData( "iconpos" ) ) : false,

// TODO values buttonId and menuId are undefined here
Expand All @@ -113,10 +120,8 @@ $.widget( "mobile.selectmenu", $.mobile.widget, $.extend( {
" ui-shadow-icon" :
"" ) ) :
"" ) +
( inline ? " ui-btn-inline" : "" ) +
( options.corners ? " ui-corner-all" : "" ) +
( options.shadow ? " ui-shadow" : "" ) +
( mini ? " ui-mini" : "" ) );
( options.shadow ? " ui-shadow" : "" ) );

this.setButtonText();

Expand Down

0 comments on commit f6624ac

Please sign in to comment.