@optionfactory/ful 0.94.0 → 0.96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ful.iife.js CHANGED
@@ -1465,6 +1465,7 @@ var ful = (function (exports) {
1465
1465
  submitter;
1466
1466
  render() {
1467
1467
  const form = document.createElement('form');
1468
+ Attributes.forward('form-', this, form);
1468
1469
  form.replaceChildren(...this.childNodes);
1469
1470
  form.addEventListener('submit', async (e) => {
1470
1471
  e.preventDefault();
@@ -1472,15 +1473,23 @@ var ful = (function (exports) {
1472
1473
  await this.submitter?.(this.values, this);
1473
1474
  });
1474
1475
  });
1476
+ if(this.hasAttribute("clear-invalid-on-change")){
1477
+ this.addEventListener('change', evt => {
1478
+ const target = /** @type HTMLElement */ (evt.target);
1479
+ target?.querySelectorAll(`.${CSS.escape(Form.INVALID_CLASS)}`).forEach(el => {
1480
+ el.classList.remove(Form.INVALID_CLASS);
1481
+ });
1482
+ });
1483
+ }
1475
1484
  this.replaceChildren(form);
1476
1485
  }
1477
1486
  spinner(spin) {
1478
1487
  this.querySelectorAll('ful-spinner').forEach(el => {
1479
- const hel = /** @type HTMLElement} */ (el);
1488
+ const hel = /** @type HTMLElement */ (el);
1480
1489
  hel.hidden = !spin;
1481
1490
  });
1482
1491
  this.querySelectorAll('[type=submit],[type=reset]').forEach(el => {
1483
- const hel = /** @type HTMLButtonElement} */ (el);
1492
+ const hel = /** @type HTMLButtonElement */ (el);
1484
1493
  hel.disabled = spin;
1485
1494
  });
1486
1495
  }