@@ -120,20 +120,26 @@ $.widget( "ui.checkboxradio", {
120
120
121
121
_getLabel : function ( ) {
122
122
var ancestor , labelSelector ;
123
-
124
- // we don't search against the document in case the element
125
- // is disconnected from the DOM
126
- ancestor = this . element . parents ( ) . last ( ) ;
127
- labelSelector = "label[for='" + this . element . attr ( "id" ) + "']" ;
128
- this . label = ancestor . find ( labelSelector ) ;
129
- if ( ! this . label . length ) {
130
- ancestor = ancestor . length ? ancestor . siblings ( ) : this . element . siblings ( ) ;
131
- this . label = ancestor . filter ( labelSelector ) ;
123
+
124
+ // Check control.labels first
125
+ if ( this . element [ 0 ] . labels !== undefined ) {
126
+ this . label = $ ( this . element [ 0 ] . labels ) ;
127
+ console . log ( this . element [ 0 ] . labels ) ;
128
+ } else {
129
+
130
+ // we don't search against the document in case the element
131
+ // is disconnected from the DOM
132
+ ancestor = this . element . parents ( ) . last ( ) ;
133
+ labelSelector = "label[for='" + this . element . attr ( "id" ) + "']" ;
134
+ this . label = ancestor . find ( labelSelector ) ;
132
135
if ( ! this . label . length ) {
133
- this . label = ancestor . find ( labelSelector ) ;
136
+ ancestor = ancestor . length ? ancestor . siblings ( ) : this . element . siblings ( ) ;
137
+ this . label = ancestor . filter ( labelSelector ) ;
138
+ if ( ! this . label . length ) {
139
+ this . label = ancestor . find ( labelSelector ) ;
140
+ }
134
141
}
135
142
}
136
-
137
143
} ,
138
144
139
145
_toggleClasses : function ( ) {
0 commit comments