Skip to content

Commit 7427582

Browse files
committed
Checkboxradio: Moving radio group to be private instance method
1 parent f94aad2 commit 7427582

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

ui/checkboxradio.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,7 @@ var formResetHandler = function() {
3030
form.find( ".ui-checkboxradio" ).checkboxradio( "refresh" );
3131
});
3232
},
33-
escapeId = new RegExp( /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g ),
34-
radioGroup = function( radio ) {
35-
var name = radio.name,
36-
form = radio.form,
37-
radios = $( [] );
38-
if ( name ) {
39-
name = name.replace( /'/g, "\\'" );
40-
if ( form ) {
41-
radios = $( form ).find( "[name='" + name + "']" );
42-
} else {
43-
radios = $( "[name='" + name + "']", radio.ownerDocument )
44-
.filter(function() {
45-
return !this.form;
46-
});
47-
}
48-
}
49-
return radios;
50-
};
33+
escapeId = new RegExp( /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g );
5134

5235
$.widget( "ui.checkboxradio", {
5336
version: "@VERSION",
@@ -186,6 +169,24 @@ $.widget( "ui.checkboxradio", {
186169
return this.label;
187170
},
188171

172+
_getRadioGroup: function( radio ) {
173+
var name = this.element[0].name,
174+
form = this.element[0].form,
175+
radios = $( [] );
176+
if ( name ) {
177+
name = name.replace( /'/g, "\\'" );
178+
if ( form ) {
179+
radios = $( form ).find( "[name='" + name + "']" );
180+
} else {
181+
radios = $( "[name='" + name + "']", radio.ownerDocument )
182+
.filter(function() {
183+
return !this.form;
184+
});
185+
}
186+
}
187+
return radios.not( this.element );
188+
},
189+
189190
_toggleClasses: function() {
190191
var checked = this.element[ 0 ].checked;
191192
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
@@ -194,8 +195,7 @@ $.widget( "ui.checkboxradio", {
194195
._toggleClass( this.icon, null, "ui-icon-blank", !checked );
195196
}
196197
if ( this.type === "radio" ) {
197-
radioGroup( this.element[0] )
198-
.not( this.element )
198+
this._getRadioGroup()
199199
.each( function(){
200200
var instance = $( this ).checkboxradio( "instance" );
201201

0 commit comments

Comments
 (0)