html-validate 10.12.0 → 10.12.2
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 +21 -7
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +4 -0
- package/dist/cjs/elements.js.map +1 -1
- package/dist/esm/core.js +21 -7
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/elements.js +4 -0
- package/dist/esm/elements.js.map +1 -1
- package/dist/schema/elements.json +6 -0
- package/dist/types/browser.d.ts +9 -0
- package/dist/types/index.d.ts +9 -0
- package/package.json +1 -1
package/dist/esm/core.js
CHANGED
|
@@ -588,6 +588,11 @@ const patternProperties = {
|
|
|
588
588
|
type: "string"
|
|
589
589
|
}
|
|
590
590
|
},
|
|
591
|
+
optionalEnd: {
|
|
592
|
+
title: "Mark element as having an optional end tag",
|
|
593
|
+
description: "Elements whose end tag may be omitted per the HTML spec. Such an element is treated as implicitly closed at end-of-document and when a parent’s explicit end tag is encountered while it is still open.",
|
|
594
|
+
type: "boolean"
|
|
595
|
+
},
|
|
591
596
|
implicitRole: {
|
|
592
597
|
title: "Implicit ARIA role for this element",
|
|
593
598
|
description: "Some elements have implicit ARIA roles.",
|
|
@@ -1155,6 +1160,13 @@ const dynamicKeys = [
|
|
|
1155
1160
|
"submitButton"
|
|
1156
1161
|
];
|
|
1157
1162
|
const schemaCache = /* @__PURE__ */ new Map();
|
|
1163
|
+
function clone(value) {
|
|
1164
|
+
if (globalThis.structuredClone) {
|
|
1165
|
+
return globalThis.structuredClone(value);
|
|
1166
|
+
} else {
|
|
1167
|
+
return JSON.parse(JSON.stringify(value));
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1158
1170
|
function overwriteMerge$1(_a, b) {
|
|
1159
1171
|
return b;
|
|
1160
1172
|
}
|
|
@@ -1166,7 +1178,7 @@ class MetaTable {
|
|
|
1166
1178
|
*/
|
|
1167
1179
|
constructor() {
|
|
1168
1180
|
this.elements = {};
|
|
1169
|
-
this.schema =
|
|
1181
|
+
this.schema = clone(schema);
|
|
1170
1182
|
}
|
|
1171
1183
|
/**
|
|
1172
1184
|
* @internal
|
|
@@ -2576,6 +2588,7 @@ class HtmlElement extends DOMNode {
|
|
|
2576
2588
|
* - foreign
|
|
2577
2589
|
* - void
|
|
2578
2590
|
* - implicitClosed
|
|
2591
|
+
* - optionalEnd
|
|
2579
2592
|
* - scriptSupporting
|
|
2580
2593
|
* - deprecatedAttributes
|
|
2581
2594
|
*
|
|
@@ -12463,7 +12476,7 @@ class EventHandler {
|
|
|
12463
12476
|
}
|
|
12464
12477
|
|
|
12465
12478
|
const name = "html-validate";
|
|
12466
|
-
const version = "10.12.
|
|
12479
|
+
const version = "10.12.2";
|
|
12467
12480
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
12468
12481
|
|
|
12469
12482
|
function freeze(src) {
|
|
@@ -12740,19 +12753,20 @@ class Parser {
|
|
|
12740
12753
|
*/
|
|
12741
12754
|
closeOptional(token) {
|
|
12742
12755
|
const active = this.dom.getActive();
|
|
12743
|
-
if (!active.meta
|
|
12756
|
+
if (!active.meta) {
|
|
12744
12757
|
return false;
|
|
12745
12758
|
}
|
|
12746
12759
|
const tagName = token.data[2];
|
|
12747
12760
|
const open = !token.data[1];
|
|
12748
|
-
const
|
|
12761
|
+
const implicitClosed = active.meta.implicitClosed;
|
|
12749
12762
|
if (open) {
|
|
12750
|
-
return
|
|
12763
|
+
return Boolean(implicitClosed?.includes(tagName));
|
|
12751
12764
|
} else {
|
|
12752
12765
|
if (active.is(tagName)) {
|
|
12753
12766
|
return false;
|
|
12754
12767
|
}
|
|
12755
|
-
|
|
12768
|
+
const canOmitEnd = Boolean(implicitClosed?.includes(active.tagName)) || Boolean(active.meta.optionalEnd);
|
|
12769
|
+
return Boolean(active.parent && active.parent.is(tagName) && canOmitEnd);
|
|
12756
12770
|
}
|
|
12757
12771
|
}
|
|
12758
12772
|
/**
|
|
@@ -13228,7 +13242,7 @@ class Parser {
|
|
|
13228
13242
|
const documentElement = this.dom.root;
|
|
13229
13243
|
let active = this.dom.getActive();
|
|
13230
13244
|
while (!active.isRootElement()) {
|
|
13231
|
-
if (active.meta?.implicitClosed) {
|
|
13245
|
+
if (active.meta?.implicitClosed || active.meta?.optionalEnd) {
|
|
13232
13246
|
active.closed = NodeClosed.ImplicitClosed;
|
|
13233
13247
|
this.closeElement(source, documentElement, active, location);
|
|
13234
13248
|
} else {
|