html-validate 8.2.0 → 8.3.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/cjs/core.js CHANGED
@@ -6422,7 +6422,7 @@ const defaults$h = {
6422
6422
  minInitialRank: "h1",
6423
6423
  sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]'],
6424
6424
  };
6425
- function isRelevant$3(event) {
6425
+ function isRelevant$4(event) {
6426
6426
  const node = event.target;
6427
6427
  return Boolean(node.meta && node.meta.heading);
6428
6428
  }
@@ -6490,7 +6490,7 @@ class HeadingLevel extends Rule {
6490
6490
  };
6491
6491
  }
6492
6492
  setup() {
6493
- this.on("tag:start", isRelevant$3, (event) => {
6493
+ this.on("tag:start", isRelevant$4, (event) => {
6494
6494
  this.onTagStart(event);
6495
6495
  });
6496
6496
  this.on("tag:ready", (event) => {
@@ -7150,7 +7150,7 @@ class MapDupName extends Rule {
7150
7150
  }
7151
7151
  }
7152
7152
 
7153
- function isRelevant$2(event) {
7153
+ function isRelevant$3(event) {
7154
7154
  return event.target.is("map");
7155
7155
  }
7156
7156
  function hasStaticValue(attr) {
@@ -7164,7 +7164,7 @@ class MapIdName extends Rule {
7164
7164
  };
7165
7165
  }
7166
7166
  setup() {
7167
- this.on("tag:ready", isRelevant$2, (event) => {
7167
+ this.on("tag:ready", isRelevant$3, (event) => {
7168
7168
  var _a;
7169
7169
  const { target } = event;
7170
7170
  const id = target.getAttribute("id");
@@ -7428,7 +7428,7 @@ class NoDupID extends Rule {
7428
7428
  const { document } = event;
7429
7429
  const existing = new Set();
7430
7430
  const elements = document.querySelectorAll("[id]");
7431
- const relevant = elements.filter(isRelevant$1);
7431
+ const relevant = elements.filter(isRelevant$2);
7432
7432
  for (const el of relevant) {
7433
7433
  const attr = el.getAttribute("id");
7434
7434
  /* istanbul ignore next: this has already been tested in isRelevant once but for type-safety it is checked again */
@@ -7444,7 +7444,7 @@ class NoDupID extends Rule {
7444
7444
  });
7445
7445
  }
7446
7446
  }
7447
- function isRelevant$1(element) {
7447
+ function isRelevant$2(element) {
7448
7448
  const attr = element.getAttribute("id");
7449
7449
  /* istanbul ignore next: can not really happen as querySelector will only return elements with id present */
7450
7450
  if (!attr) {
@@ -7461,6 +7461,41 @@ function isRelevant$1(element) {
7461
7461
  return true;
7462
7462
  }
7463
7463
 
7464
+ function isRelevant$1(event) {
7465
+ return event.target.is("button");
7466
+ }
7467
+ class NoImplicitButtonType extends Rule {
7468
+ documentation() {
7469
+ return {
7470
+ description: [
7471
+ "`<button>` is missing required `type` attribute",
7472
+ "",
7473
+ "When the `type` attribute is omitted it defaults to `submit`.",
7474
+ "Submit buttons are triggered when a keyboard user presses <kbd>Enter</kbd>.",
7475
+ "",
7476
+ "As this may or may not be inteded this rule enforces that the `type` attribute be explicitly set to one of the valid types:",
7477
+ "",
7478
+ "- `button` - a generic button.",
7479
+ "- `submit` - a submit button.",
7480
+ "- `reset`- a button to reset form fields.",
7481
+ ].join("\n"),
7482
+ url: "https://html-validate.org/rules/no-implicit-button-type.html",
7483
+ };
7484
+ }
7485
+ setup() {
7486
+ this.on("element:ready", isRelevant$1, (event) => {
7487
+ const { target } = event;
7488
+ const attr = target.getAttribute("type");
7489
+ if (!attr) {
7490
+ this.report({
7491
+ node: event.target,
7492
+ message: `<button> is missing required "type" attribute`,
7493
+ });
7494
+ }
7495
+ });
7496
+ }
7497
+ }
7498
+
7464
7499
  class NoImplicitClose extends Rule {
7465
7500
  documentation() {
7466
7501
  return {
@@ -9635,6 +9670,7 @@ const bundledRules = {
9635
9670
  "no-dup-attr": NoDupAttr,
9636
9671
  "no-dup-class": NoDupClass,
9637
9672
  "no-dup-id": NoDupID,
9673
+ "no-implicit-button-type": NoImplicitButtonType,
9638
9674
  "no-implicit-close": NoImplicitClose,
9639
9675
  "no-inline-style": NoInlineStyle,
9640
9676
  "no-missing-references": NoMissingReferences,
@@ -9681,6 +9717,7 @@ const config$4 = {
9681
9717
  "multiple-labeled-controls": "error",
9682
9718
  "no-autoplay": ["error", { include: ["audio", "video"] }],
9683
9719
  "no-dup-id": "error",
9720
+ "no-implicit-button-type": "error",
9684
9721
  "no-redundant-aria-label": "error",
9685
9722
  "no-redundant-for": "error",
9686
9723
  "no-redundant-role": "error",
@@ -9760,6 +9797,7 @@ const config$1 = {
9760
9797
  "no-dup-attr": "error",
9761
9798
  "no-dup-class": "error",
9762
9799
  "no-dup-id": "error",
9800
+ "no-implicit-button-type": "error",
9763
9801
  "no-implicit-close": "error",
9764
9802
  "no-inline-style": "error",
9765
9803
  "no-multiple-main": "error",
@@ -12218,7 +12256,7 @@ class HtmlValidate {
12218
12256
  /** @public */
12219
12257
  const name = "html-validate";
12220
12258
  /** @public */
12221
- const version = "8.2.0";
12259
+ const version = "8.3.0";
12222
12260
  /** @public */
12223
12261
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
12224
12262