html-validate 10.13.0 → 10.14.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 +234 -31
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +76 -5
- package/dist/cjs/elements.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/esm/core.js +234 -31
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/elements.js +76 -5
- package/dist/esm/elements.js.map +1 -1
- package/dist/schema/elements.json +25 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/browser.d.ts +70 -0
- package/dist/types/index.d.ts +70 -0
- package/package.json +1 -1
|
@@ -85,11 +85,35 @@
|
|
|
85
85
|
|
|
86
86
|
"implicitClosed": {
|
|
87
87
|
"title": "List of elements which implicitly closes this element",
|
|
88
|
-
"description": "Some elements are automatically closed when another start tag occurs",
|
|
88
|
+
"description": "Some elements are automatically closed when another start tag occurs. Entries may be explicit tag names or @category strings (e.g. \"@flow\").",
|
|
89
89
|
"type": "array",
|
|
90
90
|
"items": { "type": "string" }
|
|
91
91
|
},
|
|
92
92
|
|
|
93
|
+
"implicitOpen": {
|
|
94
|
+
"title": "Implicit-open rules for child elements",
|
|
95
|
+
"description": "Describes intermediary elements (e.g. <head> or <body>) that should be implicitly opened when a child of a given category or tag is inserted directly under this element without a matching container being present.",
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"required": ["for", "open"],
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"properties": {
|
|
102
|
+
"for": {
|
|
103
|
+
"title": "Selector list",
|
|
104
|
+
"description": "Tag names or @category strings (e.g. \"@flow\") that trigger the implicit open.",
|
|
105
|
+
"type": "array",
|
|
106
|
+
"items": { "type": "string" }
|
|
107
|
+
},
|
|
108
|
+
"open": {
|
|
109
|
+
"title": "Element to open",
|
|
110
|
+
"description": "Tag name of the element to implicitly open.",
|
|
111
|
+
"type": "string"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
|
|
93
117
|
"optionalEnd": {
|
|
94
118
|
"title": "Mark element as having an optional end tag",
|
|
95
119
|
"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.",
|
package/dist/tsdoc-metadata.json
CHANGED
package/dist/types/browser.d.ts
CHANGED
|
@@ -979,6 +979,9 @@ export declare class HtmlElement extends DOMNode {
|
|
|
979
979
|
/* Excluded from this release type: someChildren */
|
|
980
980
|
/* Excluded from this release type: everyChildren */
|
|
981
981
|
/* Excluded from this release type: find */
|
|
982
|
+
append(node: DOMNode): void;
|
|
983
|
+
insertBefore(node: DOMNode, reference: DOMNode | null): void;
|
|
984
|
+
removeChild<T extends DOMNode>(node: T): T;
|
|
982
985
|
/* Excluded from this release type: _setParent */
|
|
983
986
|
}
|
|
984
987
|
|
|
@@ -1334,6 +1337,25 @@ export declare class HtmlValidate {
|
|
|
1334
1337
|
flushConfigCache(filename?: string): void;
|
|
1335
1338
|
}
|
|
1336
1339
|
|
|
1340
|
+
/**
|
|
1341
|
+
* Describes a single implicit-open rule for a parent element.
|
|
1342
|
+
*
|
|
1343
|
+
* When a child element matching one of the `for` selectors would be inserted
|
|
1344
|
+
* directly under the parent but is not permitted there, the element named by
|
|
1345
|
+
* `open` is implicitly opened first, making it the new insertion point.
|
|
1346
|
+
*
|
|
1347
|
+
* Selectors may be explicit tag names (e.g., `title`) or content-category
|
|
1348
|
+
* shorthand strings prefixed with `@` (e.g., `@meta`, `@flow`).
|
|
1349
|
+
*
|
|
1350
|
+
* @public
|
|
1351
|
+
*/
|
|
1352
|
+
export declare interface ImplicitOpenEntry {
|
|
1353
|
+
/** Tags or `@category` selectors that trigger the implicit open. */
|
|
1354
|
+
for: string[];
|
|
1355
|
+
/** Tag name of the element to implicitly open. */
|
|
1356
|
+
open: string;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1337
1359
|
/**
|
|
1338
1360
|
* @public
|
|
1339
1361
|
*/
|
|
@@ -1576,6 +1598,17 @@ export declare interface MetaData {
|
|
|
1576
1598
|
* still open (e.g. `</html>` implicitly closing an open `<body>`).
|
|
1577
1599
|
*/
|
|
1578
1600
|
optionalEnd?: boolean;
|
|
1601
|
+
/**
|
|
1602
|
+
* Describes elements that should be implicitly opened when a child element
|
|
1603
|
+
* that would otherwise be inserted directly under this element matches one of
|
|
1604
|
+
* the given selectors but is not permitted here.
|
|
1605
|
+
*
|
|
1606
|
+
* This handles the HTML5 optional start-tag algorithm for `<head>` and
|
|
1607
|
+
* `<body>`: when a metadata element arrives directly under `<html>`, the
|
|
1608
|
+
* parser implicitly opens `<head>`; when a flow element arrives, it implicitly
|
|
1609
|
+
* opens `<body>` (first closing any open `<head>`).
|
|
1610
|
+
*/
|
|
1611
|
+
implicitOpen?: ImplicitOpenEntry[];
|
|
1579
1612
|
scriptSupporting?: boolean;
|
|
1580
1613
|
/** Mark element as able to receive focus (without explicit `tabindex`) */
|
|
1581
1614
|
focusable?: boolean | MetaFocusableCallback;
|
|
@@ -1887,7 +1920,44 @@ export declare class Parser {
|
|
|
1887
1920
|
* valid). The parser handles this by checking if the element on top of the
|
|
1888
1921
|
* stack when is allowed to omit.
|
|
1889
1922
|
*/
|
|
1923
|
+
/**
|
|
1924
|
+
* Check whether a given element would be implicitly closed by an incoming
|
|
1925
|
+
* start tag. Used both in `closeOptional` and in the multi-level lookahead.
|
|
1926
|
+
*/
|
|
1927
|
+
private wouldCloseElement;
|
|
1928
|
+
/**
|
|
1929
|
+
* Walk up the active stack to find the parent element that will remain
|
|
1930
|
+
* after all multi-level implicit closes triggered by the incoming start tag.
|
|
1931
|
+
* For a single-level close this is equivalent to `getActive().parent`.
|
|
1932
|
+
*/
|
|
1933
|
+
private getParentAfterImplicitClose;
|
|
1890
1934
|
private closeOptional;
|
|
1935
|
+
/**
|
|
1936
|
+
* Returns `true` if the element’s end tag may be omitted, either because
|
|
1937
|
+
* its `implicitClosed` list includes its own tag name (e.g. `<li>`, `<td>`)
|
|
1938
|
+
* or because `optionalEnd` is set.
|
|
1939
|
+
*/
|
|
1940
|
+
private canOmitEndTag;
|
|
1941
|
+
/**
|
|
1942
|
+
* Check whether the active element can be implicitly closed by an incoming
|
|
1943
|
+
* end tag. The end tag may close a direct parent or any ancestor, as long as
|
|
1944
|
+
* every intermediate element can also have its end tag omitted.
|
|
1945
|
+
* This handles cases like `</table>` implicitly closing `<td>`, `<tr>`, `<tbody>`.
|
|
1946
|
+
*/
|
|
1947
|
+
private closeOptionalEndTag;
|
|
1948
|
+
/**
|
|
1949
|
+
* Check whether an intermediary element (e.g. `<head>` or `<body>`) should
|
|
1950
|
+
* be implicitly opened before the incoming element is inserted under
|
|
1951
|
+
* `parent`.
|
|
1952
|
+
*
|
|
1953
|
+
* If the parent's metadata defines an `implicitOpen` rule that matches the
|
|
1954
|
+
* incoming element, a new `HtmlElement` for the intermediary is created and
|
|
1955
|
+
* returned (with `parent` as its parent). The caller is responsible for
|
|
1956
|
+
* pushing it onto the active stack and firing the relevant events.
|
|
1957
|
+
*
|
|
1958
|
+
* Returns `null` when no implicit open is required.
|
|
1959
|
+
*/
|
|
1960
|
+
private peekImplicitOpen;
|
|
1891
1961
|
/* Excluded from this release type: consume */
|
|
1892
1962
|
/* Excluded from this release type: consumeTag */
|
|
1893
1963
|
/* Excluded from this release type: closeElement */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1215,6 +1215,9 @@ export declare class HtmlElement extends DOMNode {
|
|
|
1215
1215
|
/* Excluded from this release type: someChildren */
|
|
1216
1216
|
/* Excluded from this release type: everyChildren */
|
|
1217
1217
|
/* Excluded from this release type: find */
|
|
1218
|
+
append(node: DOMNode): void;
|
|
1219
|
+
insertBefore(node: DOMNode, reference: DOMNode | null): void;
|
|
1220
|
+
removeChild<T extends DOMNode>(node: T): T;
|
|
1218
1221
|
/* Excluded from this release type: _setParent */
|
|
1219
1222
|
}
|
|
1220
1223
|
|
|
@@ -1570,6 +1573,25 @@ export declare class HtmlValidate {
|
|
|
1570
1573
|
flushConfigCache(filename?: string): void;
|
|
1571
1574
|
}
|
|
1572
1575
|
|
|
1576
|
+
/**
|
|
1577
|
+
* Describes a single implicit-open rule for a parent element.
|
|
1578
|
+
*
|
|
1579
|
+
* When a child element matching one of the `for` selectors would be inserted
|
|
1580
|
+
* directly under the parent but is not permitted there, the element named by
|
|
1581
|
+
* `open` is implicitly opened first, making it the new insertion point.
|
|
1582
|
+
*
|
|
1583
|
+
* Selectors may be explicit tag names (e.g., `title`) or content-category
|
|
1584
|
+
* shorthand strings prefixed with `@` (e.g., `@meta`, `@flow`).
|
|
1585
|
+
*
|
|
1586
|
+
* @public
|
|
1587
|
+
*/
|
|
1588
|
+
export declare interface ImplicitOpenEntry {
|
|
1589
|
+
/** Tags or `@category` selectors that trigger the implicit open. */
|
|
1590
|
+
for: string[];
|
|
1591
|
+
/** Tag name of the element to implicitly open. */
|
|
1592
|
+
open: string;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1573
1595
|
/**
|
|
1574
1596
|
* @public
|
|
1575
1597
|
*/
|
|
@@ -1819,6 +1841,17 @@ export declare interface MetaData {
|
|
|
1819
1841
|
* still open (e.g. `</html>` implicitly closing an open `<body>`).
|
|
1820
1842
|
*/
|
|
1821
1843
|
optionalEnd?: boolean;
|
|
1844
|
+
/**
|
|
1845
|
+
* Describes elements that should be implicitly opened when a child element
|
|
1846
|
+
* that would otherwise be inserted directly under this element matches one of
|
|
1847
|
+
* the given selectors but is not permitted here.
|
|
1848
|
+
*
|
|
1849
|
+
* This handles the HTML5 optional start-tag algorithm for `<head>` and
|
|
1850
|
+
* `<body>`: when a metadata element arrives directly under `<html>`, the
|
|
1851
|
+
* parser implicitly opens `<head>`; when a flow element arrives, it implicitly
|
|
1852
|
+
* opens `<body>` (first closing any open `<head>`).
|
|
1853
|
+
*/
|
|
1854
|
+
implicitOpen?: ImplicitOpenEntry[];
|
|
1822
1855
|
scriptSupporting?: boolean;
|
|
1823
1856
|
/** Mark element as able to receive focus (without explicit `tabindex`) */
|
|
1824
1857
|
focusable?: boolean | MetaFocusableCallback;
|
|
@@ -2155,7 +2188,44 @@ export declare class Parser {
|
|
|
2155
2188
|
* valid). The parser handles this by checking if the element on top of the
|
|
2156
2189
|
* stack when is allowed to omit.
|
|
2157
2190
|
*/
|
|
2191
|
+
/**
|
|
2192
|
+
* Check whether a given element would be implicitly closed by an incoming
|
|
2193
|
+
* start tag. Used both in `closeOptional` and in the multi-level lookahead.
|
|
2194
|
+
*/
|
|
2195
|
+
private wouldCloseElement;
|
|
2196
|
+
/**
|
|
2197
|
+
* Walk up the active stack to find the parent element that will remain
|
|
2198
|
+
* after all multi-level implicit closes triggered by the incoming start tag.
|
|
2199
|
+
* For a single-level close this is equivalent to `getActive().parent`.
|
|
2200
|
+
*/
|
|
2201
|
+
private getParentAfterImplicitClose;
|
|
2158
2202
|
private closeOptional;
|
|
2203
|
+
/**
|
|
2204
|
+
* Returns `true` if the element’s end tag may be omitted, either because
|
|
2205
|
+
* its `implicitClosed` list includes its own tag name (e.g. `<li>`, `<td>`)
|
|
2206
|
+
* or because `optionalEnd` is set.
|
|
2207
|
+
*/
|
|
2208
|
+
private canOmitEndTag;
|
|
2209
|
+
/**
|
|
2210
|
+
* Check whether the active element can be implicitly closed by an incoming
|
|
2211
|
+
* end tag. The end tag may close a direct parent or any ancestor, as long as
|
|
2212
|
+
* every intermediate element can also have its end tag omitted.
|
|
2213
|
+
* This handles cases like `</table>` implicitly closing `<td>`, `<tr>`, `<tbody>`.
|
|
2214
|
+
*/
|
|
2215
|
+
private closeOptionalEndTag;
|
|
2216
|
+
/**
|
|
2217
|
+
* Check whether an intermediary element (e.g. `<head>` or `<body>`) should
|
|
2218
|
+
* be implicitly opened before the incoming element is inserted under
|
|
2219
|
+
* `parent`.
|
|
2220
|
+
*
|
|
2221
|
+
* If the parent's metadata defines an `implicitOpen` rule that matches the
|
|
2222
|
+
* incoming element, a new `HtmlElement` for the intermediary is created and
|
|
2223
|
+
* returned (with `parent` as its parent). The caller is responsible for
|
|
2224
|
+
* pushing it onto the active stack and firing the relevant events.
|
|
2225
|
+
*
|
|
2226
|
+
* Returns `null` when no implicit open is required.
|
|
2227
|
+
*/
|
|
2228
|
+
private peekImplicitOpen;
|
|
2159
2229
|
/* Excluded from this release type: consume */
|
|
2160
2230
|
/* Excluded from this release type: consumeTag */
|
|
2161
2231
|
/* Excluded from this release type: closeElement */
|