html-validate 10.3.0 → 10.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 +49 -16
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +60 -6
- package/dist/cjs/elements.js.map +1 -1
- package/dist/cjs/meta-helper.js +5 -1
- package/dist/cjs/meta-helper.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/esm/core.js +49 -16
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/elements.js +60 -6
- package/dist/esm/elements.js.map +1 -1
- package/dist/esm/meta-helper.js +5 -1
- package/dist/esm/meta-helper.js.map +1 -1
- package/dist/schema/elements.json +2 -2
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/browser.d.ts +23 -1
- package/dist/types/index.d.ts +23 -1
- package/package.json +2 -2
package/dist/esm/elements.js
CHANGED
|
@@ -4,7 +4,8 @@ const {
|
|
|
4
4
|
allowedIfAttributeIsPresent,
|
|
5
5
|
allowedIfAttributeIsAbsent,
|
|
6
6
|
allowedIfAttributeHasValue,
|
|
7
|
-
allowedIfParentIsPresent
|
|
7
|
+
allowedIfParentIsPresent,
|
|
8
|
+
hasKeyword
|
|
8
9
|
} = metadataHelper;
|
|
9
10
|
const validId = "/\\S+/";
|
|
10
11
|
const ReferrerPolicy = [
|
|
@@ -97,7 +98,9 @@ var html5 = {
|
|
|
97
98
|
return node.hasAttribute("href");
|
|
98
99
|
},
|
|
99
100
|
phrasing: true,
|
|
100
|
-
interactive
|
|
101
|
+
interactive(node) {
|
|
102
|
+
return node.hasAttribute("href");
|
|
103
|
+
},
|
|
101
104
|
transparent: true,
|
|
102
105
|
attributes: {
|
|
103
106
|
charset: {
|
|
@@ -223,7 +226,12 @@ var html5 = {
|
|
|
223
226
|
deprecated: true
|
|
224
227
|
}
|
|
225
228
|
},
|
|
226
|
-
permittedDescendants: [
|
|
229
|
+
permittedDescendants: [
|
|
230
|
+
/* "Transparent, but there must be no interactive content descendant, a
|
|
231
|
+
* element descendant, or descendant with the tabindex attribute
|
|
232
|
+
* specified." */
|
|
233
|
+
{ exclude: ["@interactive", "a"] }
|
|
234
|
+
],
|
|
227
235
|
aria: {
|
|
228
236
|
implicitRole(node) {
|
|
229
237
|
return node.hasAttribute("href") ? "link" : "generic";
|
|
@@ -1650,9 +1658,46 @@ var html5 = {
|
|
|
1650
1658
|
boolean: true
|
|
1651
1659
|
},
|
|
1652
1660
|
href: {
|
|
1653
|
-
required
|
|
1661
|
+
required(node) {
|
|
1662
|
+
if (node.hasAttribute("imagesrcset")) {
|
|
1663
|
+
return false;
|
|
1664
|
+
}
|
|
1665
|
+
return `{{ tagName }} is missing required "href" or "imagesrcset" attribute`;
|
|
1666
|
+
},
|
|
1654
1667
|
enum: ["/.+/"]
|
|
1655
1668
|
},
|
|
1669
|
+
imagesrcset: {
|
|
1670
|
+
allowed(node) {
|
|
1671
|
+
const rel = node.getAttribute("rel");
|
|
1672
|
+
const as = node.getAttribute("as");
|
|
1673
|
+
if (!rel || typeof rel === "string" && !hasKeyword(rel, "preload")) {
|
|
1674
|
+
return `"rel" attribute must be "preload"`;
|
|
1675
|
+
}
|
|
1676
|
+
if (!as || typeof as === "string" && as !== "image") {
|
|
1677
|
+
return `"as" attribute must be "image"`;
|
|
1678
|
+
}
|
|
1679
|
+
return null;
|
|
1680
|
+
}
|
|
1681
|
+
},
|
|
1682
|
+
imagesizes: {
|
|
1683
|
+
allowed(node) {
|
|
1684
|
+
const rel = node.getAttribute("rel");
|
|
1685
|
+
const as = node.getAttribute("as");
|
|
1686
|
+
if (!rel || typeof rel === "string" && !hasKeyword(rel, "preload")) {
|
|
1687
|
+
return `"rel" attribute must be "preload"`;
|
|
1688
|
+
}
|
|
1689
|
+
if (!as || typeof as === "string" && as !== "image") {
|
|
1690
|
+
return `"as" attribute must be "image"`;
|
|
1691
|
+
}
|
|
1692
|
+
return null;
|
|
1693
|
+
},
|
|
1694
|
+
required(node) {
|
|
1695
|
+
if (node.hasAttribute("imagesrcset")) {
|
|
1696
|
+
return `{{ tagName }} requires "{{ attr }}" attribute when "imagesrcset" attribute is set`;
|
|
1697
|
+
}
|
|
1698
|
+
return false;
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1656
1701
|
integrity: {
|
|
1657
1702
|
allowed: allowedIfAttributeHasValue("rel", ["stylesheet", "preload", "modulepreload"]),
|
|
1658
1703
|
enum: ["/.+/"]
|
|
@@ -2284,6 +2329,14 @@ var html5 = {
|
|
|
2284
2329
|
return "combobox";
|
|
2285
2330
|
}
|
|
2286
2331
|
},
|
|
2332
|
+
/* "Zero or one button elements if the select is a drop-down box, followed
|
|
2333
|
+
* by zero or more select element inner content element."
|
|
2334
|
+
*
|
|
2335
|
+
* "The following are select element inner content elements:
|
|
2336
|
+
* option, optgroup, hr, script-supporting elements, noscript, div"
|
|
2337
|
+
*
|
|
2338
|
+
* https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element
|
|
2339
|
+
*/
|
|
2287
2340
|
permittedContent: [
|
|
2288
2341
|
"@script",
|
|
2289
2342
|
"button?",
|
|
@@ -2291,9 +2344,10 @@ var html5 = {
|
|
|
2291
2344
|
"datafld",
|
|
2292
2345
|
"dataformatas",
|
|
2293
2346
|
"option",
|
|
2294
|
-
"optgroup"
|
|
2347
|
+
"optgroup",
|
|
2348
|
+
"hr"
|
|
2295
2349
|
],
|
|
2296
|
-
permittedOrder: ["button", "option, optgroup"]
|
|
2350
|
+
permittedOrder: ["button", "option, optgroup, hr"]
|
|
2297
2351
|
},
|
|
2298
2352
|
selectedcontent: {
|
|
2299
2353
|
phrasing: true,
|