@@ -384,13 +384,13 @@ ZipUpdater.prototype = {
384
384
385
385
_setPostcodeOptional : function ( ) {
386
386
this . zipElement = $ ( this . zipElement ) ;
387
- if ( this . zipElement == undefined ) {
387
+ if ( this . zipElement === undefined ) {
388
388
return false ;
389
389
}
390
390
391
391
// find label
392
392
var label = $$ ( 'label[for="' + this . zipElement . id + '"]' ) [ 0 ] ;
393
- if ( label != undefined ) {
393
+ if ( label !== undefined ) {
394
394
var wildCard = label . down ( 'em' ) || label . down ( 'span.required' ) ;
395
395
if ( ! wildCard ) {
396
396
label . insert ( ' <span class="required">*</span>' ) ;
@@ -400,21 +400,21 @@ ZipUpdater.prototype = {
400
400
401
401
// Make Zip and its label required/optional
402
402
if ( optionalZipCountries . indexOf ( this . country ) != - 1 ) {
403
- if ( label . hasClassName ( 'required' ) ) {
403
+ if ( label !== undefined && label . hasClassName ( 'required' ) ) {
404
404
label . removeClassName ( 'required' ) ;
405
405
}
406
406
while ( this . zipElement . hasClassName ( 'required-entry' ) ) {
407
407
this . zipElement . removeClassName ( 'required-entry' ) ;
408
408
}
409
- if ( wildCard != undefined ) {
409
+ if ( wildCard !== undefined ) {
410
410
wildCard . hide ( ) ;
411
411
}
412
412
} else {
413
- if ( ! label . hasClassName ( 'required' ) ) {
413
+ if ( label !== undefined && ! label . hasClassName ( 'required' ) ) {
414
414
label . addClassName ( 'required' ) ;
415
415
}
416
416
this . zipElement . addClassName ( 'required-entry' ) ;
417
- if ( wildCard != undefined ) {
417
+ if ( wildCard !== undefined ) {
418
418
wildCard . show ( ) ;
419
419
}
420
420
}
0 commit comments