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/cjs/core.js
CHANGED
|
@@ -597,6 +597,11 @@ const patternProperties = {
|
|
|
597
597
|
type: "string"
|
|
598
598
|
}
|
|
599
599
|
},
|
|
600
|
+
optionalEnd: {
|
|
601
|
+
title: "Mark element as having an optional end tag",
|
|
602
|
+
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.",
|
|
603
|
+
type: "boolean"
|
|
604
|
+
},
|
|
600
605
|
implicitRole: {
|
|
601
606
|
title: "Implicit ARIA role for this element",
|
|
602
607
|
description: "Some elements have implicit ARIA roles.",
|
|
@@ -1164,6 +1169,13 @@ const dynamicKeys = [
|
|
|
1164
1169
|
"submitButton"
|
|
1165
1170
|
];
|
|
1166
1171
|
const schemaCache = /* @__PURE__ */ new Map();
|
|
1172
|
+
function clone(value) {
|
|
1173
|
+
if (globalThis.structuredClone) {
|
|
1174
|
+
return globalThis.structuredClone(value);
|
|
1175
|
+
} else {
|
|
1176
|
+
return JSON.parse(JSON.stringify(value));
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1167
1179
|
function overwriteMerge$1(_a, b) {
|
|
1168
1180
|
return b;
|
|
1169
1181
|
}
|
|
@@ -1175,7 +1187,7 @@ class MetaTable {
|
|
|
1175
1187
|
*/
|
|
1176
1188
|
constructor() {
|
|
1177
1189
|
this.elements = {};
|
|
1178
|
-
this.schema =
|
|
1190
|
+
this.schema = clone(schema);
|
|
1179
1191
|
}
|
|
1180
1192
|
/**
|
|
1181
1193
|
* @internal
|
|
@@ -2585,6 +2597,7 @@ class HtmlElement extends DOMNode {
|
|
|
2585
2597
|
* - foreign
|
|
2586
2598
|
* - void
|
|
2587
2599
|
* - implicitClosed
|
|
2600
|
+
* - optionalEnd
|
|
2588
2601
|
* - scriptSupporting
|
|
2589
2602
|
* - deprecatedAttributes
|
|
2590
2603
|
*
|
|
@@ -12472,7 +12485,7 @@ class EventHandler {
|
|
|
12472
12485
|
}
|
|
12473
12486
|
|
|
12474
12487
|
const name = "html-validate";
|
|
12475
|
-
const version = "10.12.
|
|
12488
|
+
const version = "10.12.2";
|
|
12476
12489
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
12477
12490
|
|
|
12478
12491
|
function freeze(src) {
|
|
@@ -12749,19 +12762,20 @@ class Parser {
|
|
|
12749
12762
|
*/
|
|
12750
12763
|
closeOptional(token) {
|
|
12751
12764
|
const active = this.dom.getActive();
|
|
12752
|
-
if (!active.meta
|
|
12765
|
+
if (!active.meta) {
|
|
12753
12766
|
return false;
|
|
12754
12767
|
}
|
|
12755
12768
|
const tagName = token.data[2];
|
|
12756
12769
|
const open = !token.data[1];
|
|
12757
|
-
const
|
|
12770
|
+
const implicitClosed = active.meta.implicitClosed;
|
|
12758
12771
|
if (open) {
|
|
12759
|
-
return
|
|
12772
|
+
return Boolean(implicitClosed?.includes(tagName));
|
|
12760
12773
|
} else {
|
|
12761
12774
|
if (active.is(tagName)) {
|
|
12762
12775
|
return false;
|
|
12763
12776
|
}
|
|
12764
|
-
|
|
12777
|
+
const canOmitEnd = Boolean(implicitClosed?.includes(active.tagName)) || Boolean(active.meta.optionalEnd);
|
|
12778
|
+
return Boolean(active.parent && active.parent.is(tagName) && canOmitEnd);
|
|
12765
12779
|
}
|
|
12766
12780
|
}
|
|
12767
12781
|
/**
|
|
@@ -13237,7 +13251,7 @@ class Parser {
|
|
|
13237
13251
|
const documentElement = this.dom.root;
|
|
13238
13252
|
let active = this.dom.getActive();
|
|
13239
13253
|
while (!active.isRootElement()) {
|
|
13240
|
-
if (active.meta?.implicitClosed) {
|
|
13254
|
+
if (active.meta?.implicitClosed || active.meta?.optionalEnd) {
|
|
13241
13255
|
active.closed = NodeClosed.ImplicitClosed;
|
|
13242
13256
|
this.closeElement(source, documentElement, active, location);
|
|
13243
13257
|
} else {
|