@markuplint/ml-core 4.13.2 → 4.18.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/ARCHITECTURE.ja.md +467 -0
- package/ARCHITECTURE.md +467 -0
- package/CHANGELOG.md +14 -2
- package/README.md +5 -0
- package/SKILL.md +61 -0
- package/docs/linting-pipeline.ja.md +303 -0
- package/docs/linting-pipeline.md +303 -0
- package/docs/maintenance.ja.md +210 -0
- package/docs/maintenance.md +210 -0
- package/docs/ml-dom/attr.ja.md +95 -0
- package/docs/ml-dom/attr.md +95 -0
- package/docs/ml-dom/block.ja.md +272 -0
- package/docs/ml-dom/block.md +272 -0
- package/docs/ml-dom/document.ja.md +141 -0
- package/docs/ml-dom/document.md +141 -0
- package/docs/ml-dom/element.ja.md +176 -0
- package/docs/ml-dom/element.md +176 -0
- package/docs/ml-dom/helpers.ja.md +203 -0
- package/docs/ml-dom/helpers.md +203 -0
- package/docs/ml-dom/node.ja.md +200 -0
- package/docs/ml-dom/node.md +200 -0
- package/docs/ml-dom/others.ja.md +119 -0
- package/docs/ml-dom/others.md +119 -0
- package/docs/ml-dom/overview.ja.md +102 -0
- package/docs/ml-dom/overview.md +102 -0
- package/docs/ml-dom/pretender.ja.md +269 -0
- package/docs/ml-dom/pretender.md +269 -0
- package/docs/ml-dom/rule-mapping.ja.md +371 -0
- package/docs/ml-dom/rule-mapping.md +371 -0
- package/docs/ml-dom.ja.md +18 -0
- package/docs/ml-dom.md +18 -0
- package/docs/rule-system.ja.md +270 -0
- package/docs/rule-system.md +270 -0
- package/lib/convert-ruleset.d.ts +7 -0
- package/lib/convert-ruleset.js +7 -0
- package/lib/debug.d.ts +4 -0
- package/lib/debug.js +4 -0
- package/lib/ml-core.d.ts +36 -0
- package/lib/ml-core.js +29 -0
- package/lib/ml-dom/helper/get-indent.d.ts +4 -1
- package/lib/ml-dom/helper/get-indent.js +4 -1
- package/lib/ml-dom/node/attr.d.ts +65 -4
- package/lib/ml-dom/node/attr.js +53 -4
- package/lib/ml-dom/node/block.d.ts +21 -0
- package/lib/ml-dom/node/block.js +14 -0
- package/lib/ml-dom/node/child-node.d.ts +9 -0
- package/lib/ml-dom/node/child-node.js +9 -0
- package/lib/ml-dom/node/comment.d.ts +7 -0
- package/lib/ml-dom/node/comment.js +7 -0
- package/lib/ml-dom/node/document-fragment.d.ts +8 -0
- package/lib/ml-dom/node/document-fragment.js +8 -0
- package/lib/ml-dom/node/document-type.d.ts +22 -0
- package/lib/ml-dom/node/document-type.js +13 -0
- package/lib/ml-dom/node/document.d.ts +98 -4
- package/lib/ml-dom/node/document.js +87 -2
- package/lib/ml-dom/node/element.d.ts +164 -11
- package/lib/ml-dom/node/element.js +135 -6
- package/lib/ml-dom/node/node.d.ts +23 -0
- package/lib/ml-dom/node/node.js +29 -0
- package/lib/ml-dom/node/text.d.ts +12 -0
- package/lib/ml-dom/node/text.js +12 -0
- package/lib/ml-dom/node/types.d.ts +68 -0
- package/lib/ml-dom/token/token.d.ts +42 -0
- package/lib/ml-dom/token/token.js +36 -0
- package/lib/ml-rule/create-rule.d.ts +9 -0
- package/lib/ml-rule/create-rule.js +9 -0
- package/lib/ml-rule/ml-rule.d.ts +33 -0
- package/lib/ml-rule/ml-rule.js +30 -0
- package/lib/ml-rule/types.d.ts +41 -0
- package/lib/plugin/plugin.d.ts +8 -0
- package/lib/plugin/plugin.js +8 -0
- package/lib/plugin/types.d.ts +21 -0
- package/lib/ruleset/index.d.ts +10 -0
- package/lib/ruleset/index.js +7 -0
- package/lib/test/index.d.ts +42 -1
- package/lib/test/index.js +35 -1
- package/lib/types.d.ts +8 -0
- package/lib/violation-collector.d.ts +33 -0
- package/lib/violation-collector.js +33 -0
- package/package.json +14 -14
|
@@ -25,6 +25,15 @@ import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
|
25
25
|
const log = coreLog.extend('ml-dom');
|
|
26
26
|
const docLog = log.extend('document');
|
|
27
27
|
const ruleLog = docLog.extend('rule');
|
|
28
|
+
/**
|
|
29
|
+
* Represents a DOM Document node wrapper in the markuplint DOM tree.
|
|
30
|
+
* Serves as the root node of the parsed document, managing the node list,
|
|
31
|
+
* rule mappings, pretender initialization, accessibility computation,
|
|
32
|
+
* and document-level configuration (end tag handling, booleanish values, etc.).
|
|
33
|
+
*
|
|
34
|
+
* @template T - The rule configuration value type
|
|
35
|
+
* @template O - The rule options type
|
|
36
|
+
*/
|
|
28
37
|
export class MLDocument extends MLParentNode {
|
|
29
38
|
/**
|
|
30
39
|
*
|
|
@@ -35,11 +44,13 @@ export class MLDocument extends MLParentNode {
|
|
|
35
44
|
// @ts-ignore
|
|
36
45
|
super(ast, null);
|
|
37
46
|
/**
|
|
38
|
-
*
|
|
47
|
+
* The rule currently being evaluated during a lint pass.
|
|
48
|
+
* Set by the linting engine before rule evaluation begins and used by nodes
|
|
49
|
+
* to retrieve their rule configuration. Null when no rule is being evaluated.
|
|
39
50
|
*/
|
|
40
51
|
this.currentRule = null;
|
|
41
52
|
/**
|
|
42
|
-
*
|
|
53
|
+
* The file path of the source document, if available.
|
|
43
54
|
*/
|
|
44
55
|
_MLDocument_filename.set(this, void 0);
|
|
45
56
|
_MLDocument_tokenList.set(this, null);
|
|
@@ -89,6 +100,16 @@ export class MLDocument extends MLParentNode {
|
|
|
89
100
|
get activeElement() {
|
|
90
101
|
throw new UnexpectedCallError('Not supported "activeElement" property');
|
|
91
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
105
|
+
*
|
|
106
|
+
* @deprecated
|
|
107
|
+
* @unsupported
|
|
108
|
+
* @implements DOM API: `Document`
|
|
109
|
+
*/
|
|
110
|
+
get activeViewTransition() {
|
|
111
|
+
throw new UnexpectedCallError('Not supported "activeViewTransition" property');
|
|
112
|
+
}
|
|
92
113
|
/**
|
|
93
114
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
94
115
|
*
|
|
@@ -212,6 +233,16 @@ export class MLDocument extends MLParentNode {
|
|
|
212
233
|
get currentScript() {
|
|
213
234
|
throw new UnexpectedCallError('Not supported "currentScript" property');
|
|
214
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
238
|
+
*
|
|
239
|
+
* @deprecated
|
|
240
|
+
* @unsupported
|
|
241
|
+
* @implements DOM API: `Document`
|
|
242
|
+
*/
|
|
243
|
+
get customElementRegistry() {
|
|
244
|
+
throw new UnexpectedCallError('Not supported "customElementRegistry" property');
|
|
245
|
+
}
|
|
215
246
|
/**
|
|
216
247
|
* Window object for calling the `getComputedStyle` and the `getPropertyValue` that
|
|
217
248
|
* are needed by **Accessible Name and Description Computation**.
|
|
@@ -628,6 +659,16 @@ export class MLDocument extends MLParentNode {
|
|
|
628
659
|
get onclose() {
|
|
629
660
|
throw new UnexpectedCallError('Not supported "onclose" property');
|
|
630
661
|
}
|
|
662
|
+
/**
|
|
663
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
664
|
+
*
|
|
665
|
+
* @deprecated
|
|
666
|
+
* @unsupported
|
|
667
|
+
* @implements DOM API: `Document`
|
|
668
|
+
*/
|
|
669
|
+
get oncommand() {
|
|
670
|
+
throw new UnexpectedCallError('Not supported "oncommand" property');
|
|
671
|
+
}
|
|
631
672
|
/**
|
|
632
673
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
633
674
|
*
|
|
@@ -1833,7 +1874,11 @@ export class MLDocument extends MLParentNode {
|
|
|
1833
1874
|
throw new UnexpectedCallError('Not supported "createTreeWalker" method');
|
|
1834
1875
|
}
|
|
1835
1876
|
/**
|
|
1877
|
+
* Returns a debug-friendly string array representing the structure of the document's
|
|
1878
|
+
* node list, useful for debugging and test assertions.
|
|
1879
|
+
*
|
|
1836
1880
|
* @implements `@markuplint/ml-core` API: `MLDocument`
|
|
1881
|
+
* @returns An array of strings describing each node in the document
|
|
1837
1882
|
*/
|
|
1838
1883
|
debugMap() {
|
|
1839
1884
|
return nodeListToDebugMaps(this.nodeList, true);
|
|
@@ -1908,6 +1953,15 @@ export class MLDocument extends MLParentNode {
|
|
|
1908
1953
|
exitPointerLock() {
|
|
1909
1954
|
throw new UnexpectedCallError('Not supported "exitPointerLock" method');
|
|
1910
1955
|
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Computes the accessibility properties for the given node, including its
|
|
1958
|
+
* ARIA role, accessible name, focusability, and ARIA property values.
|
|
1959
|
+
* Returns null for non-element nodes.
|
|
1960
|
+
*
|
|
1961
|
+
* @param node - The node to compute accessibility properties for
|
|
1962
|
+
* @param ariaVersion - The ARIA specification version to use for computation
|
|
1963
|
+
* @returns The computed accessibility properties, or null for non-element nodes
|
|
1964
|
+
*/
|
|
1911
1965
|
getAccessibilityProp(
|
|
1912
1966
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1913
1967
|
node, ariaVersion = ARIA_RECOMMENDED_VERSION) {
|
|
@@ -2022,7 +2076,11 @@ export class MLDocument extends MLParentNode {
|
|
|
2022
2076
|
throw new UnexpectedCallError('Not supported "getSelection" method');
|
|
2023
2077
|
}
|
|
2024
2078
|
/**
|
|
2079
|
+
* Returns a flat, offset-sorted list of all tokens in the document,
|
|
2080
|
+
* including element close tags. The result is cached after the first call.
|
|
2081
|
+
*
|
|
2025
2082
|
* @implements `@markuplint/ml-core` API: `MLDocument`
|
|
2083
|
+
* @returns A frozen array of tokens sorted by their starting offset
|
|
2026
2084
|
*/
|
|
2027
2085
|
getTokenList() {
|
|
2028
2086
|
if (__classPrivateFieldGet(this, _MLDocument_tokenList, "f")) {
|
|
@@ -2145,7 +2203,12 @@ export class MLDocument extends MLParentNode {
|
|
|
2145
2203
|
throw new UnexpectedCallError('Not supported "requestStorageAccess" method');
|
|
2146
2204
|
}
|
|
2147
2205
|
/**
|
|
2206
|
+
* Searches for a node at the given source location (line and column).
|
|
2207
|
+
*
|
|
2148
2208
|
* @implements `@markuplint/ml-core` API: `MLDocument`
|
|
2209
|
+
* @param line - The 1-based line number to search at
|
|
2210
|
+
* @param col - The 1-based column number to search at
|
|
2211
|
+
* @returns The node at the given location, or null if not found
|
|
2149
2212
|
*/
|
|
2150
2213
|
searchNodeByLocation(line, col) {
|
|
2151
2214
|
for (const node of this.nodeList) {
|
|
@@ -2156,7 +2219,11 @@ export class MLDocument extends MLParentNode {
|
|
|
2156
2219
|
return null;
|
|
2157
2220
|
}
|
|
2158
2221
|
/**
|
|
2222
|
+
* Sets the currently active rule for this document. Called by the linting engine
|
|
2223
|
+
* before each rule evaluation pass.
|
|
2224
|
+
*
|
|
2159
2225
|
* @implements `@markuplint/ml-core` API: `MLDocument`
|
|
2226
|
+
* @param rule - The rule to set as current, or null to clear
|
|
2160
2227
|
*/
|
|
2161
2228
|
setRule(rule) {
|
|
2162
2229
|
this.currentRule = rule;
|
|
@@ -2171,7 +2238,13 @@ export class MLDocument extends MLParentNode {
|
|
|
2171
2238
|
throw new UnexpectedCallError('Not supported "startViewTransition" method');
|
|
2172
2239
|
}
|
|
2173
2240
|
/**
|
|
2241
|
+
* Returns a string representation of the entire document. When `fixed` is true,
|
|
2242
|
+
* returns the document with all lint fixes applied by substituting
|
|
2243
|
+
* fixed token content at the appropriate offsets.
|
|
2244
|
+
*
|
|
2174
2245
|
* @implements `@markuplint/ml-core` API: `MLDocument`
|
|
2246
|
+
* @param fixed - When true, returns the fixed content; otherwise returns the original raw content
|
|
2247
|
+
* @returns The string content of the document
|
|
2175
2248
|
*/
|
|
2176
2249
|
toString(fixed = false) {
|
|
2177
2250
|
if (!fixed) {
|
|
@@ -2229,6 +2302,11 @@ export class MLDocument extends MLParentNode {
|
|
|
2229
2302
|
writeln(...text) {
|
|
2230
2303
|
throw new UnexpectedCallError('Not supported "writeln" method');
|
|
2231
2304
|
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Initializes pretender contexts for all element nodes in the document.
|
|
2307
|
+
*
|
|
2308
|
+
* @param pretenders - Optional pretender configurations from the document options
|
|
2309
|
+
*/
|
|
2232
2310
|
_pretending(pretenders) {
|
|
2233
2311
|
if (docLog.enabled) {
|
|
2234
2312
|
docLog('Pretending: %O', pretenders);
|
|
@@ -2239,6 +2317,13 @@ export class MLDocument extends MLParentNode {
|
|
|
2239
2317
|
}
|
|
2240
2318
|
}
|
|
2241
2319
|
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Maps the ruleset configuration to each node in the document.
|
|
2322
|
+
* Applies global rules, node-specific rules (by selector), and
|
|
2323
|
+
* child-node rules to build the per-node rule configuration.
|
|
2324
|
+
*
|
|
2325
|
+
* @param ruleset - The ruleset containing rules, nodeRules, and childNodeRules
|
|
2326
|
+
*/
|
|
2242
2327
|
_ruleMapping(ruleset) {
|
|
2243
2328
|
if (docLog.enabled) {
|
|
2244
2329
|
docLog('Rule Mapping: %O', Object.keys(ruleset.rules));
|
|
@@ -12,8 +12,20 @@ import { MLAttr } from './attr.js';
|
|
|
12
12
|
import { MLDomTokenList } from './dom-token-list.js';
|
|
13
13
|
import { MLElementCloseTag } from './element-close-tag.js';
|
|
14
14
|
import { MLParentNode } from './parent-node.js';
|
|
15
|
+
/**
|
|
16
|
+
* Represents a DOM Element node wrapper in the markuplint DOM tree.
|
|
17
|
+
* Provides access to element attributes, tag names, namespace, ARIA properties,
|
|
18
|
+
* accessibility information, pretender context, and CSS selector matching.
|
|
19
|
+
* This is the primary class used for linting HTML elements.
|
|
20
|
+
*
|
|
21
|
+
* @template T - The rule configuration value type
|
|
22
|
+
* @template O - The rule options type
|
|
23
|
+
*/
|
|
15
24
|
export declare class MLElement<T extends RuleConfigValue, O extends PlainData = undefined> extends MLParentNode<T, O, MLASTElement> implements Element, HTMLOrSVGElement, HTMLElement {
|
|
16
25
|
#private;
|
|
26
|
+
/**
|
|
27
|
+
* The closing tag for this element, or null if the element is self-closing or void.
|
|
28
|
+
*/
|
|
17
29
|
readonly closeTag: MLElementCloseTag<T, O> | null;
|
|
18
30
|
/**
|
|
19
31
|
* Element type
|
|
@@ -23,17 +35,45 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
23
35
|
* - `authored`: Authored element (JSX Element etc.) through the view framework or the template engine.
|
|
24
36
|
*/
|
|
25
37
|
readonly elementType: ElementType;
|
|
38
|
+
/**
|
|
39
|
+
* Whether this element belongs to a non-HTML namespace (e.g., SVG or MathML).
|
|
40
|
+
*/
|
|
26
41
|
readonly isForeignElement: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether this element was implicitly created (e.g., an omitted `<body>` tag in HTML).
|
|
44
|
+
*/
|
|
27
45
|
readonly isOmitted: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The namespace URI of this element (e.g., `http://www.w3.org/1999/xhtml` for HTML elements).
|
|
48
|
+
*/
|
|
28
49
|
readonly namespaceURI: NamespaceURI;
|
|
29
50
|
readonly ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
30
51
|
readonly ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
31
52
|
readonly ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
32
53
|
readonly ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The pretender context if this element is participating in pretender behavior,
|
|
56
|
+
* or null if it is not a pretender or pretended element.
|
|
57
|
+
*/
|
|
33
58
|
pretenderContext: PretenderContext<MLElement<T, O>, T, O> | null;
|
|
59
|
+
/**
|
|
60
|
+
* The self-closing solidus token (`/`), or null if the element is not self-closing.
|
|
61
|
+
*/
|
|
34
62
|
readonly selfClosingSolidus: MLToken | null;
|
|
63
|
+
/**
|
|
64
|
+
* The tag close character string (e.g., `>` or `/>` or `%>`).
|
|
65
|
+
*/
|
|
35
66
|
readonly tagCloseChar: string;
|
|
67
|
+
/**
|
|
68
|
+
* The tag open character string (e.g., `<` or `<%`).
|
|
69
|
+
*/
|
|
36
70
|
readonly tagOpenChar: string;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new MLElement instance from an AST element node.
|
|
73
|
+
*
|
|
74
|
+
* @param astNode - The AST element node to wrap
|
|
75
|
+
* @param document - The owning document
|
|
76
|
+
*/
|
|
37
77
|
constructor(astNode: MLASTElement, document: MLDocument<T, O>);
|
|
38
78
|
/**
|
|
39
79
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -146,7 +186,7 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
146
186
|
* @unsupported
|
|
147
187
|
* @implements DOM API: `Element`
|
|
148
188
|
*/
|
|
149
|
-
get ariaControlsElements(): readonly MLElement<T, O>[];
|
|
189
|
+
get ariaControlsElements(): readonly MLElement<T, O>[] | null;
|
|
150
190
|
/**
|
|
151
191
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
152
192
|
*
|
|
@@ -162,7 +202,7 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
162
202
|
* @unsupported
|
|
163
203
|
* @implements DOM API: `Element`
|
|
164
204
|
*/
|
|
165
|
-
get ariaDescribedByElements(): readonly MLElement<T, O>[];
|
|
205
|
+
get ariaDescribedByElements(): readonly MLElement<T, O>[] | null;
|
|
166
206
|
/**
|
|
167
207
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
168
208
|
*
|
|
@@ -178,7 +218,7 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
178
218
|
* @unsupported
|
|
179
219
|
* @implements DOM API: `Element`
|
|
180
220
|
*/
|
|
181
|
-
get ariaDetailsElements(): readonly MLElement<T, O>[];
|
|
221
|
+
get ariaDetailsElements(): readonly MLElement<T, O>[] | null;
|
|
182
222
|
/**
|
|
183
223
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
184
224
|
*
|
|
@@ -194,7 +234,7 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
194
234
|
* @unsupported
|
|
195
235
|
* @implements DOM API: `Element`
|
|
196
236
|
*/
|
|
197
|
-
get ariaErrorMessageElements(): readonly MLElement<T, O>[];
|
|
237
|
+
get ariaErrorMessageElements(): readonly MLElement<T, O>[] | null;
|
|
198
238
|
/**
|
|
199
239
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
200
240
|
*
|
|
@@ -210,7 +250,7 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
210
250
|
* @unsupported
|
|
211
251
|
* @implements DOM API: `Element`
|
|
212
252
|
*/
|
|
213
|
-
get ariaFlowToElements(): readonly MLElement<T, O>[];
|
|
253
|
+
get ariaFlowToElements(): readonly MLElement<T, O>[] | null;
|
|
214
254
|
/**
|
|
215
255
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
216
256
|
*
|
|
@@ -258,7 +298,7 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
258
298
|
* @unsupported
|
|
259
299
|
* @implements DOM API: `Element`
|
|
260
300
|
*/
|
|
261
|
-
get ariaLabelledByElements(): readonly MLElement<T, O>[];
|
|
301
|
+
get ariaLabelledByElements(): readonly MLElement<T, O>[] | null;
|
|
262
302
|
/**
|
|
263
303
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
264
304
|
*
|
|
@@ -314,7 +354,7 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
314
354
|
* @unsupported
|
|
315
355
|
* @implements DOM API: `Element`
|
|
316
356
|
*/
|
|
317
|
-
get ariaOwnsElements(): readonly MLElement<T, O>[];
|
|
357
|
+
get ariaOwnsElements(): readonly MLElement<T, O>[] | null;
|
|
318
358
|
/**
|
|
319
359
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
320
360
|
*
|
|
@@ -467,6 +507,12 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
467
507
|
* @see https://dom.spec.whatwg.org/#dom-slotable-assignedslot
|
|
468
508
|
*/
|
|
469
509
|
get assignedSlot(): HTMLSlotElement | null;
|
|
510
|
+
/**
|
|
511
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
512
|
+
*
|
|
513
|
+
* @unsupported
|
|
514
|
+
* @implements DOM API: `Element`
|
|
515
|
+
*/
|
|
470
516
|
get attributeStyleMap(): StylePropertyMap;
|
|
471
517
|
/**
|
|
472
518
|
* @implements DOM API: `Element`
|
|
@@ -555,6 +601,14 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
555
601
|
* @implements DOM API: `Element`
|
|
556
602
|
*/
|
|
557
603
|
get currentCSSZoom(): number;
|
|
604
|
+
/**
|
|
605
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
606
|
+
*
|
|
607
|
+
* @deprecated
|
|
608
|
+
* @unsupported
|
|
609
|
+
* @implements DOM API: `Element`
|
|
610
|
+
*/
|
|
611
|
+
get customElementRegistry(): CustomElementRegistry | null;
|
|
558
612
|
/**
|
|
559
613
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
560
614
|
*
|
|
@@ -588,9 +642,15 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
588
642
|
*/
|
|
589
643
|
get enterKeyHint(): string;
|
|
590
644
|
/**
|
|
645
|
+
* Returns the fixed (potentially corrected) node name, which may differ from the
|
|
646
|
+
* original node name after lint fixes such as case normalization.
|
|
647
|
+
*
|
|
591
648
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
592
649
|
*/
|
|
593
650
|
get fixedNodeName(): string;
|
|
651
|
+
/**
|
|
652
|
+
* Whether this element has any spread attributes (e.g., `{...props}` in JSX).
|
|
653
|
+
*/
|
|
594
654
|
get hasSpreadAttr(): boolean;
|
|
595
655
|
/**
|
|
596
656
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -695,7 +755,7 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
695
755
|
* @unsupported
|
|
696
756
|
* @implements DOM API: `Element`
|
|
697
757
|
*/
|
|
698
|
-
get nonce(): string
|
|
758
|
+
get nonce(): string;
|
|
699
759
|
/**
|
|
700
760
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
701
761
|
*
|
|
@@ -864,6 +924,14 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
864
924
|
* @implements DOM API: `Element`
|
|
865
925
|
*/
|
|
866
926
|
get onclose(): ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
927
|
+
/**
|
|
928
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
929
|
+
*
|
|
930
|
+
* @deprecated
|
|
931
|
+
* @unsupported
|
|
932
|
+
* @implements DOM API: `Element`
|
|
933
|
+
*/
|
|
934
|
+
get oncommand(): ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
867
935
|
/**
|
|
868
936
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
869
937
|
*
|
|
@@ -1560,6 +1628,9 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1560
1628
|
*/
|
|
1561
1629
|
get previousElementSibling(): MLElement<T, O> | null;
|
|
1562
1630
|
/**
|
|
1631
|
+
* Returns the original raw element name exactly as it appears in the AST,
|
|
1632
|
+
* without any case normalization or pretender resolution.
|
|
1633
|
+
*
|
|
1563
1634
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1564
1635
|
*/
|
|
1565
1636
|
get rawName(): string;
|
|
@@ -1572,6 +1643,9 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1572
1643
|
*/
|
|
1573
1644
|
get role(): string;
|
|
1574
1645
|
/**
|
|
1646
|
+
* Returns the rule configuration for this element, respecting the pretender context.
|
|
1647
|
+
* If the element is a pretended origin, returns the rule from the pretending element.
|
|
1648
|
+
*
|
|
1575
1649
|
* @implements `@markuplint/ml-core` API: `MLNode`
|
|
1576
1650
|
*/
|
|
1577
1651
|
get rule(): RuleInfo<T, O>;
|
|
@@ -1762,6 +1836,12 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1762
1836
|
* @implements DOM API: `Element`
|
|
1763
1837
|
*/
|
|
1764
1838
|
computedStyleMap(): StylePropertyMapReadOnly;
|
|
1839
|
+
/**
|
|
1840
|
+
* Overrides the fixed node name for this element, used when the element's
|
|
1841
|
+
* tag name needs to be corrected during linting (e.g., case normalization).
|
|
1842
|
+
*
|
|
1843
|
+
* @param name - The new node name to set
|
|
1844
|
+
*/
|
|
1765
1845
|
fixNodeName(name: string): void;
|
|
1766
1846
|
/**
|
|
1767
1847
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -1772,7 +1852,12 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1772
1852
|
*/
|
|
1773
1853
|
focus(options?: FocusOptions): void;
|
|
1774
1854
|
/**
|
|
1855
|
+
* Computes the accessible name of this element according to the
|
|
1856
|
+
* Accessible Name and Description Computation algorithm.
|
|
1857
|
+
*
|
|
1775
1858
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1859
|
+
* @param version - The ARIA specification version to use for computation
|
|
1860
|
+
* @returns The computed accessible name string
|
|
1776
1861
|
*/
|
|
1777
1862
|
getAccessibleName(version: ARIAVersion): string;
|
|
1778
1863
|
/**
|
|
@@ -1815,15 +1900,29 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1815
1900
|
*/
|
|
1816
1901
|
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
1817
1902
|
/**
|
|
1903
|
+
* Gets the attribute value from the original (non-pretended) attributes list,
|
|
1904
|
+
* bypassing any pretender context that might be active.
|
|
1905
|
+
*
|
|
1818
1906
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1907
|
+
* @param attrName - The attribute name to look up (case-insensitive)
|
|
1908
|
+
* @returns The attribute value, or null if the attribute is not found
|
|
1819
1909
|
*/
|
|
1820
1910
|
getAttributePretended(attrName: string): string | null;
|
|
1821
1911
|
/**
|
|
1912
|
+
* Returns all attribute tokens matching the given name, including duplicates.
|
|
1913
|
+
* Unlike `getAttribute`, this returns the full `MLAttr` token objects.
|
|
1914
|
+
*
|
|
1822
1915
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1916
|
+
* @param attrName - The attribute name to look up (case-insensitive)
|
|
1917
|
+
* @returns An array of matching attribute tokens
|
|
1823
1918
|
*/
|
|
1824
1919
|
getAttributeToken(attrName: string): MLAttr<T, O>[];
|
|
1825
1920
|
/**
|
|
1921
|
+
* Returns all attribute tokens for this element, respecting the pretender context.
|
|
1922
|
+
* If the element is pretending to be another, returns the pretender's attributes.
|
|
1923
|
+
*
|
|
1826
1924
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1925
|
+
* @returns A frozen array of all attribute tokens
|
|
1827
1926
|
*/
|
|
1828
1927
|
getAttributeTokens(): readonly MLAttr<T, O>[];
|
|
1829
1928
|
/**
|
|
@@ -1834,6 +1933,13 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1834
1933
|
* @see https://www.w3.org/TR/cssom-view-1/#ref-for-dom-element-getboundingclientrect-1
|
|
1835
1934
|
*/
|
|
1836
1935
|
getBoundingClientRect(): DOMRect;
|
|
1936
|
+
/**
|
|
1937
|
+
* Returns child elements and non-whitespace text nodes, skipping omitted elements
|
|
1938
|
+
* by flattening their children into the result. Results are cached for performance.
|
|
1939
|
+
*
|
|
1940
|
+
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1941
|
+
* @returns An array of child elements and non-whitespace text nodes
|
|
1942
|
+
*/
|
|
1837
1943
|
getChildElementsAndTextNodeWithoutWhitespaces(): (MLElement<T, O> | MLText<T, O>)[];
|
|
1838
1944
|
/**
|
|
1839
1945
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -1870,7 +1976,10 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1870
1976
|
*/
|
|
1871
1977
|
getHTML(options?: any): string;
|
|
1872
1978
|
/**
|
|
1979
|
+
* Returns the source location of the element's tag name (excluding the opening `<` character).
|
|
1980
|
+
*
|
|
1873
1981
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1982
|
+
* @returns An object with `offset`, `line`, and `col` properties indicating where the name starts
|
|
1874
1983
|
*/
|
|
1875
1984
|
getNameLocation(): {
|
|
1876
1985
|
offset: number;
|
|
@@ -1896,13 +2005,21 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1896
2005
|
*/
|
|
1897
2006
|
hasAttributes(): boolean;
|
|
1898
2007
|
/**
|
|
2008
|
+
* Checks whether this element has any mutable attributes, such as spread
|
|
2009
|
+
* attributes or attributes with dynamic values from template expressions.
|
|
2010
|
+
*
|
|
1899
2011
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2012
|
+
* @returns True if any attribute is dynamic or lacks a name node (spread)
|
|
1900
2013
|
*/
|
|
1901
2014
|
hasMutableAttributes(): boolean;
|
|
1902
2015
|
/**
|
|
1903
|
-
*
|
|
2016
|
+
* Checks whether this element has children that are potentially mutable,
|
|
2017
|
+
* such as preprocessor-specific blocks, slot elements, or (optionally) elements
|
|
2018
|
+
* with dynamic attributes.
|
|
1904
2019
|
*
|
|
1905
2020
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2021
|
+
* @param attr - When true, also considers children with mutable attributes as mutable
|
|
2022
|
+
* @returns True if this element has potentially mutable children
|
|
1906
2023
|
*/
|
|
1907
2024
|
hasMutableChildren(attr?: boolean): boolean;
|
|
1908
2025
|
/**
|
|
@@ -1946,21 +2063,46 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1946
2063
|
*/
|
|
1947
2064
|
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
1948
2065
|
/**
|
|
2066
|
+
* Checks whether this element is a descendant of any element whose UUID
|
|
2067
|
+
* is in the given list, by walking up the parent element chain.
|
|
2068
|
+
*
|
|
1949
2069
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2070
|
+
* @param uuidList - A list of element UUIDs to check against
|
|
2071
|
+
* @returns True if any ancestor element's UUID is in the list
|
|
1950
2072
|
*/
|
|
1951
2073
|
isDescendantByUUIDList(uuidList: readonly string[]): boolean;
|
|
1952
2074
|
/**
|
|
2075
|
+
* Checks whether this element has no meaningful child content
|
|
2076
|
+
* (only whitespace-only text nodes or no children at all).
|
|
2077
|
+
*
|
|
1953
2078
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2079
|
+
* @returns True if the element has no non-whitespace child content
|
|
1954
2080
|
*/
|
|
1955
2081
|
isEmpty(): boolean;
|
|
1956
2082
|
/**
|
|
1957
2083
|
* @implements DOM API: `Element`
|
|
1958
2084
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-element-matches%E2%91%A0
|
|
1959
2085
|
*/
|
|
1960
|
-
matches
|
|
2086
|
+
matches<K extends keyof HTMLElementTagNameMap>(selectors: K): this is HTMLElementTagNameMap[K];
|
|
2087
|
+
matches<K extends keyof SVGElementTagNameMap>(selectors: K): this is SVGElementTagNameMap[K];
|
|
2088
|
+
matches<K extends keyof MathMLElementTagNameMap>(selectors: K): this is MathMLElementTagNameMap[K];
|
|
2089
|
+
matches(selectors: string, scope?: MLParentNode<T, O>): boolean;
|
|
2090
|
+
/**
|
|
2091
|
+
* Matches this element against a CSS selector or regex selector pattern,
|
|
2092
|
+
* returning detailed match results. When the element is a pretender,
|
|
2093
|
+
* it attempts to match both as the pretender and as the original element.
|
|
2094
|
+
*
|
|
2095
|
+
* @param selector - The CSS selector string or regex selector to match against
|
|
2096
|
+
* @param scope - An optional scope node for scoped selector matching
|
|
2097
|
+
* @returns The detailed match result including captured groups from regex selectors
|
|
2098
|
+
*/
|
|
1961
2099
|
matchMLSelector(selector: string | RegexSelector | undefined, scope?: MLParentNode<T, O>): SelectorMatches;
|
|
1962
2100
|
/**
|
|
1963
|
-
*
|
|
2101
|
+
* Initializes the pretender context for this element based on the given pretender
|
|
2102
|
+
* configurations. If a matching pretender is found or the element has an `as` attribute,
|
|
2103
|
+
* sets up the pretender/pretended relationship between elements.
|
|
2104
|
+
*
|
|
2105
|
+
* @param pretenders - Optional array of pretender configurations to match against
|
|
1964
2106
|
*/
|
|
1965
2107
|
pretending(pretenders?: readonly Pretender[]): void;
|
|
1966
2108
|
/**
|
|
@@ -2108,11 +2250,22 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
2108
2250
|
*/
|
|
2109
2251
|
showPopover(): void;
|
|
2110
2252
|
/**
|
|
2253
|
+
* Returns a normalized string representation of this element including its tag name,
|
|
2254
|
+
* attributes, and child content. Whitespace-only text nodes are excluded.
|
|
2255
|
+
* The result is cached for repeated calls.
|
|
2256
|
+
*
|
|
2111
2257
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2258
|
+
* @returns The normalized HTML string of this element
|
|
2112
2259
|
*/
|
|
2113
2260
|
toNormalizeString(): string;
|
|
2114
2261
|
/**
|
|
2262
|
+
* Returns a string representation of this element. When `fixed` is true,
|
|
2263
|
+
* returns the element with any lint fixes applied to the tag name,
|
|
2264
|
+
* attributes, and embedded comment nodes.
|
|
2265
|
+
*
|
|
2115
2266
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2267
|
+
* @param fixed - When true, returns the fixed content; otherwise returns the original raw content
|
|
2268
|
+
* @returns The string content of this element
|
|
2116
2269
|
*/
|
|
2117
2270
|
toString(fixed?: boolean): string;
|
|
2118
2271
|
/**
|