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