Skip to content

Commit 19c6b9e

Browse files
committed
checkboxradio: fix label selection if control.labels length is 0
there still might be a label so check the old way.
1 parent b782bfc commit 19c6b9e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ui/button.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ $.widget( "ui.button", {
8989
if( this.options.iconPosition ) {
9090
this.element.addClass( "ui-icon-" + this.options.iconPosition );
9191
}
92-
if( !this.options.text ){
92+
if( !this.options.showLabel ){
9393
this.element.addClass( " ui-button-icon-only" );
9494
}
9595
this.element.append( this.icon );
@@ -125,7 +125,7 @@ $.widget( "ui.button", {
125125
this.title = this.element.attr( "title" );
126126
this.hasTitle = !!this.title;
127127

128-
if( !this.options.text ){
128+
if( !this.options.showLabel ){
129129
if ( !this.hasTitle ) {
130130
this.element.attr( "title", this.title );
131131
}
@@ -154,7 +154,7 @@ $.widget( "ui.button", {
154154
.toggleClass( this.options.iconPosition, !!value );
155155
this._setTitle();
156156
}
157-
if( key === "iconPosition" && this.options.text ) {
157+
if( key === "iconPosition" && this.options.showLabel ) {
158158
this.element.addClass( value )
159159
.removeClass( this.options.iconPosition );
160160
}

ui/checkboxradio.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ $.widget( "ui.checkboxradio", {
8787
});
8888
},
8989

90-
enhance: function() {
90+
_enhance: function() {
9191
this.element.addClass( "ui-helper-hidden-accessible ui-checkboxradio" );
9292

9393
this.label.addClass( baseClasses + " ui-" + this.type + "-label" );
@@ -126,8 +126,8 @@ $.widget( "ui.checkboxradio", {
126126
var ancestor, labelSelector;
127127

128128
// Check control.labels first
129-
if ( this.element[ 0 ].labels !== undefined ){
130-
this.label = $( this.element[ 0 ].labels );
129+
if ( this.element[ 0 ].labels !== undefined && this.element[ 0 ].labels.length > 0 ){
130+
this.label = $( this.element[ 0 ].labels[0] );
131131
} else {
132132

133133
// We don't search against the document in case the element

0 commit comments

Comments
 (0)