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/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.",
|
|
@@ -2592,6 +2597,7 @@ class HtmlElement extends DOMNode {
|
|
|
2592
2597
|
* - foreign
|
|
2593
2598
|
* - void
|
|
2594
2599
|
* - implicitClosed
|
|
2600
|
+
* - optionalEnd
|
|
2595
2601
|
* - scriptSupporting
|
|
2596
2602
|
* - deprecatedAttributes
|
|
2597
2603
|
*
|
|
@@ -12479,7 +12485,7 @@ class EventHandler {
|
|
|
12479
12485
|
}
|
|
12480
12486
|
|
|
12481
12487
|
const name = "html-validate";
|
|
12482
|
-
const version = "10.12.
|
|
12488
|
+
const version = "10.12.2";
|
|
12483
12489
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
12484
12490
|
|
|
12485
12491
|
function freeze(src) {
|
|
@@ -12756,19 +12762,20 @@ class Parser {
|
|
|
12756
12762
|
*/
|
|
12757
12763
|
closeOptional(token) {
|
|
12758
12764
|
const active = this.dom.getActive();
|
|
12759
|
-
if (!active.meta
|
|
12765
|
+
if (!active.meta) {
|
|
12760
12766
|
return false;
|
|
12761
12767
|
}
|
|
12762
12768
|
const tagName = token.data[2];
|
|
12763
12769
|
const open = !token.data[1];
|
|
12764
|
-
const
|
|
12770
|
+
const implicitClosed = active.meta.implicitClosed;
|
|
12765
12771
|
if (open) {
|
|
12766
|
-
return
|
|
12772
|
+
return Boolean(implicitClosed?.includes(tagName));
|
|
12767
12773
|
} else {
|
|
12768
12774
|
if (active.is(tagName)) {
|
|
12769
12775
|
return false;
|
|
12770
12776
|
}
|
|
12771
|
-
|
|
12777
|
+
const canOmitEnd = Boolean(implicitClosed?.includes(active.tagName)) || Boolean(active.meta.optionalEnd);
|
|
12778
|
+
return Boolean(active.parent && active.parent.is(tagName) && canOmitEnd);
|
|
12772
12779
|
}
|
|
12773
12780
|
}
|
|
12774
12781
|
/**
|
|
@@ -13244,7 +13251,7 @@ class Parser {
|
|
|
13244
13251
|
const documentElement = this.dom.root;
|
|
13245
13252
|
let active = this.dom.getActive();
|
|
13246
13253
|
while (!active.isRootElement()) {
|
|
13247
|
-
if (active.meta?.implicitClosed) {
|
|
13254
|
+
if (active.meta?.implicitClosed || active.meta?.optionalEnd) {
|
|
13248
13255
|
active.closed = NodeClosed.ImplicitClosed;
|
|
13249
13256
|
this.closeElement(source, documentElement, active, location);
|
|
13250
13257
|
} else {
|