Skip to content

Commit

Permalink
Fix some JSHint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonge committed Apr 15, 2014
1 parent c64fa32 commit bf5d492
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions media/system/js/validate-uncompressed.js
Expand Up @@ -63,7 +63,7 @@ var JFormValidator = new Class({

setHandler: function(name, fn, en)
{
en = (en == '') ? true : en;
en = (en === '') ? true : en;
this.handlers[name] = { enabled: en, exec: fn };
},

Expand Down Expand Up @@ -121,15 +121,15 @@ var JFormValidator = new Class({

// Only validate the field if the validate class is set
var handler = (el.className && el.className.search(/validate-([a-zA-Z0-9\_\-]+)/) != -1) ? el.className.match(/validate-([a-zA-Z0-9\_\-]+)/)[1] : "";
if (handler == '') {
if (handler === '') {
this.handleResponse(true, el);
return true;
}

// Check the additional validation types
if ((handler) && (handler != 'none') && (this.handlers[handler]) && el.get('value')) {
// Execute the validation handler and return result
if (this.handlers[handler].exec(el.get('value')) != true) {
if (this.handlers[handler].exec(el.get('value')) !== true) {
this.handleResponse(false, el);
return false;
}
Expand All @@ -147,14 +147,14 @@ var JFormValidator = new Class({
// Validate form fields
var elements = form.getElements('fieldset').concat(Array.from(form.elements));
for (var i=0;i < elements.length; i++) {
if (this.validate(elements[i]) == false) {
if (this.validate(elements[i]) === false) {
valid = false;
}
}

// Run custom form validators if present
new Hash(this.custom).each(function(validator){
if (validator.exec() != true) {
if (validator.exec() !== true) {
valid = false;
}
});
Expand All @@ -163,7 +163,7 @@ var JFormValidator = new Class({
var message = Joomla.JText._('JLIB_FORM_FIELD_INVALID');
var errors = jQuery("label.invalid");
var error = new Object();
error.error = new Array();
error.error = [];
for (var i=0;i < errors.length; i++) {
var label = jQuery(errors[i]).text();
if (label != 'undefined') {
Expand All @@ -189,7 +189,7 @@ var JFormValidator = new Class({
}

// Set the element and its label (if exists) invalid state
if (state == false) {
if (state === false) {
el.addClass('invalid');
el.set('aria-invalid', 'true');
if (el.labelref) {
Expand Down

0 comments on commit bf5d492

Please sign in to comment.