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/cjs/core.js +95 -25
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +113 -3
- package/dist/cjs/elements.js.map +1 -1
- package/dist/esm/core.js +95 -25
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/elements.js +113 -3
- package/dist/esm/elements.js.map +1 -1
- package/dist/schema/elements.json +5 -0
- package/dist/types/browser.d.ts +10 -0
- package/dist/types/index.d.ts +10 -0
- package/package.json +1 -1
package/dist/cjs/core.js
CHANGED
|
@@ -906,6 +906,13 @@ const definitions = {
|
|
|
906
906
|
type: "boolean",
|
|
907
907
|
title: "Set to true if this attribute can optionally omit its value"
|
|
908
908
|
},
|
|
909
|
+
reference: {
|
|
910
|
+
type: "string",
|
|
911
|
+
"enum": [
|
|
912
|
+
"id"
|
|
913
|
+
],
|
|
914
|
+
title: "Set when the attribute references another element."
|
|
915
|
+
},
|
|
909
916
|
required: {
|
|
910
917
|
title: "Set to true or a function to evaluate if this attribute is required",
|
|
911
918
|
oneOf: [
|
|
@@ -7551,10 +7558,58 @@ class IdPattern extends BasePatternRule {
|
|
|
7551
7558
|
|
|
7552
7559
|
const restricted = /* @__PURE__ */ new Map([
|
|
7553
7560
|
["accept", ["file"]],
|
|
7561
|
+
["alpha", ["color"]],
|
|
7554
7562
|
["alt", ["image"]],
|
|
7563
|
+
[
|
|
7564
|
+
"autocapitalize",
|
|
7565
|
+
[
|
|
7566
|
+
"button",
|
|
7567
|
+
"checkbox",
|
|
7568
|
+
"color",
|
|
7569
|
+
"date",
|
|
7570
|
+
"datetime-local",
|
|
7571
|
+
"file",
|
|
7572
|
+
"hidden",
|
|
7573
|
+
"image",
|
|
7574
|
+
"month",
|
|
7575
|
+
"number",
|
|
7576
|
+
"radio",
|
|
7577
|
+
"range",
|
|
7578
|
+
"reset",
|
|
7579
|
+
"search",
|
|
7580
|
+
"submit",
|
|
7581
|
+
"tel",
|
|
7582
|
+
"text",
|
|
7583
|
+
"time",
|
|
7584
|
+
"week"
|
|
7585
|
+
]
|
|
7586
|
+
],
|
|
7587
|
+
[
|
|
7588
|
+
"autocomplete",
|
|
7589
|
+
[
|
|
7590
|
+
"color",
|
|
7591
|
+
"date",
|
|
7592
|
+
"datetime-local",
|
|
7593
|
+
"email",
|
|
7594
|
+
"file",
|
|
7595
|
+
"hidden",
|
|
7596
|
+
"image",
|
|
7597
|
+
"month",
|
|
7598
|
+
"number",
|
|
7599
|
+
"password",
|
|
7600
|
+
"range",
|
|
7601
|
+
"search",
|
|
7602
|
+
"tel",
|
|
7603
|
+
"text",
|
|
7604
|
+
"time",
|
|
7605
|
+
"url",
|
|
7606
|
+
"week"
|
|
7607
|
+
]
|
|
7608
|
+
],
|
|
7555
7609
|
["capture", ["file"]],
|
|
7556
7610
|
["checked", ["checkbox", "radio"]],
|
|
7557
|
-
["
|
|
7611
|
+
["colorspace", ["color"]],
|
|
7612
|
+
["dirname", ["hidden", "text", "search", "url", "tel", "email"]],
|
|
7558
7613
|
["height", ["image"]],
|
|
7559
7614
|
[
|
|
7560
7615
|
"list",
|
|
@@ -7581,6 +7636,8 @@ const restricted = /* @__PURE__ */ new Map([
|
|
|
7581
7636
|
["multiple", ["email", "file"]],
|
|
7582
7637
|
["pattern", ["text", "search", "url", "tel", "email", "password"]],
|
|
7583
7638
|
["placeholder", ["text", "search", "url", "tel", "email", "password", "number"]],
|
|
7639
|
+
["popovertarget", ["button"]],
|
|
7640
|
+
["popovertargetaction", ["button"]],
|
|
7584
7641
|
[
|
|
7585
7642
|
"readonly",
|
|
7586
7643
|
[
|
|
@@ -7621,6 +7678,31 @@ const restricted = /* @__PURE__ */ new Map([
|
|
|
7621
7678
|
["size", ["text", "search", "url", "tel", "email", "password"]],
|
|
7622
7679
|
["src", ["image"]],
|
|
7623
7680
|
["step", ["date", "month", "week", "time", "datetime-local", "number", "range"]],
|
|
7681
|
+
[
|
|
7682
|
+
"value",
|
|
7683
|
+
[
|
|
7684
|
+
"button",
|
|
7685
|
+
"checkbox",
|
|
7686
|
+
"color",
|
|
7687
|
+
"date",
|
|
7688
|
+
"datetime-local",
|
|
7689
|
+
"email",
|
|
7690
|
+
"hidden",
|
|
7691
|
+
"month",
|
|
7692
|
+
"number",
|
|
7693
|
+
"password",
|
|
7694
|
+
"radio",
|
|
7695
|
+
"range",
|
|
7696
|
+
"reset",
|
|
7697
|
+
"search",
|
|
7698
|
+
"submit",
|
|
7699
|
+
"tel",
|
|
7700
|
+
"text",
|
|
7701
|
+
"time",
|
|
7702
|
+
"url",
|
|
7703
|
+
"week"
|
|
7704
|
+
]
|
|
7705
|
+
],
|
|
7624
7706
|
["width", ["image"]]
|
|
7625
7707
|
]);
|
|
7626
7708
|
function isInput(event) {
|
|
@@ -8612,16 +8694,6 @@ class NoInlineStyle extends Rule {
|
|
|
8612
8694
|
}
|
|
8613
8695
|
}
|
|
8614
8696
|
|
|
8615
|
-
const ARIA = [
|
|
8616
|
-
{ property: "aria-activedescendant", isList: false },
|
|
8617
|
-
{ property: "aria-controls", isList: true },
|
|
8618
|
-
{ property: "aria-describedby", isList: true },
|
|
8619
|
-
{ property: "aria-details", isList: false },
|
|
8620
|
-
{ property: "aria-errormessage", isList: false },
|
|
8621
|
-
{ property: "aria-flowto", isList: true },
|
|
8622
|
-
{ property: "aria-labelledby", isList: true },
|
|
8623
|
-
{ property: "aria-owns", isList: true }
|
|
8624
|
-
];
|
|
8625
8697
|
function idMissing(document, id) {
|
|
8626
8698
|
const nodes = document.querySelectorAll(generateIdSelector(id));
|
|
8627
8699
|
return nodes.length === 0;
|
|
@@ -8636,20 +8708,18 @@ class NoMissingReferences extends Rule {
|
|
|
8636
8708
|
setup() {
|
|
8637
8709
|
this.on("dom:ready", (event) => {
|
|
8638
8710
|
const document = event.document;
|
|
8639
|
-
|
|
8640
|
-
const
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
for (const node of document.querySelectorAll("input[list]")) {
|
|
8644
|
-
const attr = node.getAttribute("list");
|
|
8645
|
-
this.validateReference(document, node, attr, false);
|
|
8646
|
-
}
|
|
8647
|
-
for (const { property, isList } of ARIA) {
|
|
8648
|
-
for (const node of document.querySelectorAll(`[${property}]`)) {
|
|
8649
|
-
const attr = node.getAttribute(property);
|
|
8650
|
-
this.validateReference(document, node, attr, isList);
|
|
8711
|
+
walk.depthFirst(document, (node) => {
|
|
8712
|
+
const meta = node.meta;
|
|
8713
|
+
if (!meta?.attributes) {
|
|
8714
|
+
return;
|
|
8651
8715
|
}
|
|
8652
|
-
|
|
8716
|
+
for (const attr of node.attributes) {
|
|
8717
|
+
const attrMeta = meta.attributes[attr.key];
|
|
8718
|
+
if (attrMeta?.reference === "id") {
|
|
8719
|
+
this.validateReference(document, node, attr, attrMeta.list ?? false);
|
|
8720
|
+
}
|
|
8721
|
+
}
|
|
8722
|
+
});
|
|
8653
8723
|
});
|
|
8654
8724
|
}
|
|
8655
8725
|
validateReference(document, node, attr, isList) {
|
|
@@ -12714,7 +12784,7 @@ class EventHandler {
|
|
|
12714
12784
|
}
|
|
12715
12785
|
|
|
12716
12786
|
const name = "html-validate";
|
|
12717
|
-
const version = "11.
|
|
12787
|
+
const version = "11.4.0";
|
|
12718
12788
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
12719
12789
|
|
|
12720
12790
|
function freeze(src) {
|