Skip to content

Commit 3225dbd

Browse files
committed
tech(pat-validation): Cleanup - better variable names.
1 parent 6f08bd7 commit 3225dbd

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/pat/validation/validation.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class Pattern extends BasePattern {
125125
);
126126
}
127127

128-
get disableable() {
128+
get disableables() {
129129
// Return all elements, which should be disabled when there are errors.
130130
return [...this.form.elements].filter((input) =>
131131
input.matches(this.options.disableSelector)
@@ -302,23 +302,23 @@ class Pattern extends BasePattern {
302302
const max_values = input_options.maxValues !== null && parseInt(input_options.maxValues, 10) || null;
303303

304304
let number_values = 0;
305-
for (const _inp of this.siblings(input)) {
305+
for (const _input of this.siblings(input)) {
306306
// Check if checkboxes or radios are checked ...
307-
if (_inp.type === "checkbox" || _inp.type === "radio") {
308-
if (_inp.checked) {
307+
if (_input.type === "checkbox" || _input.type === "radio") {
308+
if (_input.checked) {
309309
number_values++;
310310
}
311311
continue;
312312
}
313313

314314
// Select, if select is selected.
315-
if (_inp.tagName === "SELECT") {
316-
number_values += _inp.selectedOptions.length;
315+
if (_input.tagName === "SELECT") {
316+
number_values += _input.selectedOptions.length;
317317
continue;
318318
}
319319

320320
// For the rest a value must be set.
321-
if (_inp.value === 0 || _inp.value) {
321+
if (_input.value === 0 || _input.value) {
322322
number_values++;
323323
}
324324
}
@@ -454,21 +454,21 @@ class Pattern extends BasePattern {
454454
// Get all inputs with the same name - e.g. radio buttons, checkboxes.
455455
inputs = this.siblings(input);
456456
}
457-
for (const it of inputs) {
457+
for (const _input of inputs) {
458458
if (clear_state) {
459-
this.set_error({ input: it, msg: "", skip_event: true });
459+
this.set_error({ input: _input, msg: "", skip_event: true });
460460
}
461-
const error_node = it[KEY_ERROR_EL];
462-
it[KEY_ERROR_EL] = null;
461+
const error_node = _input[KEY_ERROR_EL];
462+
_input[KEY_ERROR_EL] = null;
463463
error_node?.remove();
464464
}
465465

466466
// disable selector
467467
if (this.form.checkValidity()) {
468-
for (const it of this.disableable) {
469-
if (it.disabled) {
470-
it.removeAttribute("disabled");
471-
it.classList.remove("disabled");
468+
for (const _input of this.disableables) {
469+
if (_input.disabled) {
470+
_input.removeAttribute("disabled");
471+
_input.classList.remove("disabled");
472472
}
473473
}
474474
}
@@ -490,7 +490,7 @@ class Pattern extends BasePattern {
490490
// Do not set a error message for a input group like radio buttons or
491491
// checkboxes where one has already been set.
492492
const inputs = this.siblings(input);
493-
if (inputs.length > 1 && inputs.some((it) => !!it[KEY_ERROR_EL])) {
493+
if (inputs.length > 1 && inputs.some((_input) => !!_input[KEY_ERROR_EL])) {
494494
// error message for input group already set.
495495
return;
496496
}
@@ -507,15 +507,15 @@ class Pattern extends BasePattern {
507507
input[KEY_ERROR_EL] = error_node;
508508

509509
let did_disable = false;
510-
for (const it of this.disableable) {
510+
for (const _input of this.disableables) {
511511
// Disable for melements if they are not already disabled and which
512512
// do not have set the `formnovalidate` attribute, e.g.
513513
// `<button formnovalidate>cancel</button>`.
514-
if (!it.disabled && !it.formNoValidate) {
514+
if (!_input.disabled && !_input.formNoValidate) {
515515
did_disable = true;
516-
it.setAttribute("disabled", "disabled");
517-
it.classList.add("disabled");
518-
logger.debug("Disable element", it);
516+
_input.setAttribute("disabled", "disabled");
517+
_input.classList.add("disabled");
518+
logger.debug("Disable element", _input);
519519
}
520520
}
521521

0 commit comments

Comments
 (0)