html-validate 10.12.1 → 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 +13 -6
- 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 +13 -6
- 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.",
|
|
@@ -2583,6 +2588,7 @@ class HtmlElement extends DOMNode {
|
|
|
2583
2588
|
* - foreign
|
|
2584
2589
|
* - void
|
|
2585
2590
|
* - implicitClosed
|
|
2591
|
+
* - optionalEnd
|
|
2586
2592
|
* - scriptSupporting
|
|
2587
2593
|
* - deprecatedAttributes
|
|
2588
2594
|
*
|
|
@@ -12470,7 +12476,7 @@ class EventHandler {
|
|
|
12470
12476
|
}
|
|
12471
12477
|
|
|
12472
12478
|
const name = "html-validate";
|
|
12473
|
-
const version = "10.12.
|
|
12479
|
+
const version = "10.12.2";
|
|
12474
12480
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
12475
12481
|
|
|
12476
12482
|
function freeze(src) {
|
|
@@ -12747,19 +12753,20 @@ class Parser {
|
|
|
12747
12753
|
*/
|
|
12748
12754
|
closeOptional(token) {
|
|
12749
12755
|
const active = this.dom.getActive();
|
|
12750
|
-
if (!active.meta
|
|
12756
|
+
if (!active.meta) {
|
|
12751
12757
|
return false;
|
|
12752
12758
|
}
|
|
12753
12759
|
const tagName = token.data[2];
|
|
12754
12760
|
const open = !token.data[1];
|
|
12755
|
-
const
|
|
12761
|
+
const implicitClosed = active.meta.implicitClosed;
|
|
12756
12762
|
if (open) {
|
|
12757
|
-
return
|
|
12763
|
+
return Boolean(implicitClosed?.includes(tagName));
|
|
12758
12764
|
} else {
|
|
12759
12765
|
if (active.is(tagName)) {
|
|
12760
12766
|
return false;
|
|
12761
12767
|
}
|
|
12762
|
-
|
|
12768
|
+
const canOmitEnd = Boolean(implicitClosed?.includes(active.tagName)) || Boolean(active.meta.optionalEnd);
|
|
12769
|
+
return Boolean(active.parent && active.parent.is(tagName) && canOmitEnd);
|
|
12763
12770
|
}
|
|
12764
12771
|
}
|
|
12765
12772
|
/**
|
|
@@ -13235,7 +13242,7 @@ class Parser {
|
|
|
13235
13242
|
const documentElement = this.dom.root;
|
|
13236
13243
|
let active = this.dom.getActive();
|
|
13237
13244
|
while (!active.isRootElement()) {
|
|
13238
|
-
if (active.meta?.implicitClosed) {
|
|
13245
|
+
if (active.meta?.implicitClosed || active.meta?.optionalEnd) {
|
|
13239
13246
|
active.closed = NodeClosed.ImplicitClosed;
|
|
13240
13247
|
this.closeElement(source, documentElement, active, location);
|
|
13241
13248
|
} else {
|