html-validate 11.3.0 → 11.4.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/esm/core.js CHANGED
@@ -897,6 +897,13 @@ const definitions = {
897
897
  type: "boolean",
898
898
  title: "Set to true if this attribute can optionally omit its value"
899
899
  },
900
+ reference: {
901
+ type: "string",
902
+ "enum": [
903
+ "id"
904
+ ],
905
+ title: "Set when the attribute references another element."
906
+ },
900
907
  required: {
901
908
  title: "Set to true or a function to evaluate if this attribute is required",
902
909
  oneOf: [
@@ -7542,10 +7549,58 @@ class IdPattern extends BasePatternRule {
7542
7549
 
7543
7550
  const restricted = /* @__PURE__ */ new Map([
7544
7551
  ["accept", ["file"]],
7552
+ ["alpha", ["color"]],
7545
7553
  ["alt", ["image"]],
7554
+ [
7555
+ "autocapitalize",
7556
+ [
7557
+ "button",
7558
+ "checkbox",
7559
+ "color",
7560
+ "date",
7561
+ "datetime-local",
7562
+ "file",
7563
+ "hidden",
7564
+ "image",
7565
+ "month",
7566
+ "number",
7567
+ "radio",
7568
+ "range",
7569
+ "reset",
7570
+ "search",
7571
+ "submit",
7572
+ "tel",
7573
+ "text",
7574
+ "time",
7575
+ "week"
7576
+ ]
7577
+ ],
7578
+ [
7579
+ "autocomplete",
7580
+ [
7581
+ "color",
7582
+ "date",
7583
+ "datetime-local",
7584
+ "email",
7585
+ "file",
7586
+ "hidden",
7587
+ "image",
7588
+ "month",
7589
+ "number",
7590
+ "password",
7591
+ "range",
7592
+ "search",
7593
+ "tel",
7594
+ "text",
7595
+ "time",
7596
+ "url",
7597
+ "week"
7598
+ ]
7599
+ ],
7546
7600
  ["capture", ["file"]],
7547
7601
  ["checked", ["checkbox", "radio"]],
7548
- ["dirname", ["text", "search"]],
7602
+ ["colorspace", ["color"]],
7603
+ ["dirname", ["hidden", "text", "search", "url", "tel", "email"]],
7549
7604
  ["height", ["image"]],
7550
7605
  [
7551
7606
  "list",
@@ -7572,6 +7627,8 @@ const restricted = /* @__PURE__ */ new Map([
7572
7627
  ["multiple", ["email", "file"]],
7573
7628
  ["pattern", ["text", "search", "url", "tel", "email", "password"]],
7574
7629
  ["placeholder", ["text", "search", "url", "tel", "email", "password", "number"]],
7630
+ ["popovertarget", ["button"]],
7631
+ ["popovertargetaction", ["button"]],
7575
7632
  [
7576
7633
  "readonly",
7577
7634
  [
@@ -7612,6 +7669,31 @@ const restricted = /* @__PURE__ */ new Map([
7612
7669
  ["size", ["text", "search", "url", "tel", "email", "password"]],
7613
7670
  ["src", ["image"]],
7614
7671
  ["step", ["date", "month", "week", "time", "datetime-local", "number", "range"]],
7672
+ [
7673
+ "value",
7674
+ [
7675
+ "button",
7676
+ "checkbox",
7677
+ "color",
7678
+ "date",
7679
+ "datetime-local",
7680
+ "email",
7681
+ "hidden",
7682
+ "month",
7683
+ "number",
7684
+ "password",
7685
+ "radio",
7686
+ "range",
7687
+ "reset",
7688
+ "search",
7689
+ "submit",
7690
+ "tel",
7691
+ "text",
7692
+ "time",
7693
+ "url",
7694
+ "week"
7695
+ ]
7696
+ ],
7615
7697
  ["width", ["image"]]
7616
7698
  ]);
7617
7699
  function isInput(event) {
@@ -8603,16 +8685,6 @@ class NoInlineStyle extends Rule {
8603
8685
  }
8604
8686
  }
8605
8687
 
8606
- const ARIA = [
8607
- { property: "aria-activedescendant", isList: false },
8608
- { property: "aria-controls", isList: true },
8609
- { property: "aria-describedby", isList: true },
8610
- { property: "aria-details", isList: false },
8611
- { property: "aria-errormessage", isList: false },
8612
- { property: "aria-flowto", isList: true },
8613
- { property: "aria-labelledby", isList: true },
8614
- { property: "aria-owns", isList: true }
8615
- ];
8616
8688
  function idMissing(document, id) {
8617
8689
  const nodes = document.querySelectorAll(generateIdSelector(id));
8618
8690
  return nodes.length === 0;
@@ -8627,20 +8699,18 @@ class NoMissingReferences extends Rule {
8627
8699
  setup() {
8628
8700
  this.on("dom:ready", (event) => {
8629
8701
  const document = event.document;
8630
- for (const node of document.querySelectorAll("label[for]")) {
8631
- const attr = node.getAttribute("for");
8632
- this.validateReference(document, node, attr, false);
8633
- }
8634
- for (const node of document.querySelectorAll("input[list]")) {
8635
- const attr = node.getAttribute("list");
8636
- this.validateReference(document, node, attr, false);
8637
- }
8638
- for (const { property, isList } of ARIA) {
8639
- for (const node of document.querySelectorAll(`[${property}]`)) {
8640
- const attr = node.getAttribute(property);
8641
- this.validateReference(document, node, attr, isList);
8702
+ walk.depthFirst(document, (node) => {
8703
+ const meta = node.meta;
8704
+ if (!meta?.attributes) {
8705
+ return;
8642
8706
  }
8643
- }
8707
+ for (const attr of node.attributes) {
8708
+ const attrMeta = meta.attributes[attr.key];
8709
+ if (attrMeta?.reference === "id") {
8710
+ this.validateReference(document, node, attr, attrMeta.list ?? false);
8711
+ }
8712
+ }
8713
+ });
8644
8714
  });
8645
8715
  }
8646
8716
  validateReference(document, node, attr, isList) {
@@ -12705,7 +12775,7 @@ class EventHandler {
12705
12775
  }
12706
12776
 
12707
12777
  const name = "html-validate";
12708
- const version = "11.3.0";
12778
+ const version = "11.4.0";
12709
12779
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
12710
12780
 
12711
12781
  function freeze(src) {