Skip to content

Commit

Permalink
optimize validation.js performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Oct 2, 2014
1 parent 7d2450c commit 9e20ab2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion media/system/js/validate-uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ var JFormValidator = function() {
},

handleResponse = function(state, $el) {
// Get a label
var $label = $el.data('label');
if($label === undefined){
$label = findLabel($el.attr('id'), $el.parents('form'));
$el.data('label', $label);
}

// Set the element and its label (if exists) invalid state
if (state === false) {
$el.addClass('invalid').attr('aria-invalid', 'true');
Expand Down Expand Up @@ -148,7 +154,6 @@ var JFormValidator = function() {
$el.get(0).type = 'email';
}
}
$el.data('label', findLabel(id, form));
inputFields.push($el);
}
});
Expand Down
2 changes: 1 addition & 1 deletion media/system/js/validate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9e20ab2

Please sign in to comment.