@@ -25,6 +25,10 @@ define([
25
25
isMultipleCountriesAllowed : true
26
26
} ,
27
27
28
+ /**
29
+ *
30
+ * @private
31
+ */
28
32
_create : function ( ) {
29
33
this . _initCountryElement ( ) ;
30
34
@@ -43,12 +47,18 @@ define([
43
47
} , this ) ) ;
44
48
} ,
45
49
46
- _initCountryElement : function ( ) {
50
+ /**
51
+ *
52
+ * @private
53
+ */
54
+ _initCountryElement : function ( ) {
55
+
47
56
if ( this . options . isMultipleCountriesAllowed ) {
48
57
this . element . parents ( 'div.field' ) . show ( ) ;
49
58
this . element . on ( 'change' , $ . proxy ( function ( e ) {
50
59
this . _updateRegion ( $ ( e . target ) . val ( ) ) ;
51
60
} , this ) ) ;
61
+
52
62
if ( this . options . isCountryRequired ) {
53
63
this . element . addClass ( 'required-entry' ) ;
54
64
this . element . parents ( 'div.field' ) . addClass ( 'required' ) ;
@@ -60,6 +70,7 @@ define([
60
70
61
71
/**
62
72
* Remove options from dropdown list
73
+ *
63
74
* @param {Object } selectElement - jQuery object for dropdown list
64
75
* @private
65
76
*/
@@ -113,7 +124,7 @@ define([
113
124
* @private
114
125
*/
115
126
_clearError : function ( ) {
116
- if ( this . options . clearError && typeof ( this . options . clearError ) === 'function' ) {
127
+ if ( this . options . clearError && typeof this . options . clearError === 'function' ) {
117
128
this . options . clearError . call ( this ) ;
118
129
} else {
119
130
if ( ! this . options . form ) {
@@ -131,8 +142,10 @@ define([
131
142
$ ( this . options . postcodeId ) . removeClass ( 'mage-error' ) . parent ( ) . find ( '[generated]' ) . remove ( ) ;
132
143
}
133
144
} ,
145
+
134
146
/**
135
147
* Update dropdown list based on the country selected
148
+ *
136
149
* @param {String } country - 2 uppercase letter for country code
137
150
* @private
138
151
*/
@@ -188,7 +201,7 @@ define([
188
201
regionInput . attr ( 'disabled' , 'disabled' ) ;
189
202
}
190
203
requiredLabel . removeClass ( 'required' ) ;
191
- regionInput . removeClass ( 'required-entry' )
204
+ regionInput . removeClass ( 'required-entry' ) ;
192
205
}
193
206
194
207
regionList . removeClass ( 'required-entry' ) . hide ( ) ;
@@ -214,10 +227,11 @@ define([
214
227
* @private
215
228
*/
216
229
_checkRegionRequired : function ( country ) {
217
- this . options . isRegionRequired = false ;
218
230
var self = this ;
231
+
232
+ this . options . isRegionRequired = false ;
219
233
$ . each ( this . options . regionJson . config . regions_required , function ( index , elem ) {
220
- if ( elem == country ) {
234
+ if ( elem === country ) {
221
235
self . options . isRegionRequired = true ;
222
236
}
223
237
} ) ;
0 commit comments