Skip to content

Commit

Permalink
Remove some jQuery from executeAllValidators
Browse files Browse the repository at this point in the history
`element.dataset` and `$element.data` are not the same thing
  • Loading branch information
tagliala committed Dec 15, 2024
1 parent 8c6fe71 commit fa2bbd2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dist/client-side-validations.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ var isMarkedForDestroy = function isMarkedForDestroy($element) {
return false;
};
var executeAllValidators = function executeAllValidators($element, validators) {
if ($element.data('changed') === false || $element.prop('disabled')) {
var element = $element[0];
if ($element.data('changed') === false || element.disabled) {
return;
}
$element.data('changed', false);
Expand Down
3 changes: 2 additions & 1 deletion dist/client-side-validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,8 @@
return false;
};
var executeAllValidators = function executeAllValidators($element, validators) {
if ($element.data('changed') === false || $element.prop('disabled')) {
var element = $element[0];
if ($element.data('changed') === false || element.disabled) {
return;
}
$element.data('changed', false);
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ const isMarkedForDestroy = ($element) => {
}

const executeAllValidators = ($element, validators) => {
if ($element.data('changed') === false || $element.prop('disabled')) {
const element = $element[0]
if ($element.data('changed') === false || element.disabled) {
return
}

Expand Down
3 changes: 2 additions & 1 deletion vendor/assets/javascripts/rails.validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,8 @@
return false;
};
var executeAllValidators = function executeAllValidators($element, validators) {
if ($element.data('changed') === false || $element.prop('disabled')) {
var element = $element[0];
if ($element.data('changed') === false || element.disabled) {
return;
}
$element.data('changed', false);
Expand Down

0 comments on commit fa2bbd2

Please sign in to comment.