@markuplint/ml-core 3.0.0-alpha.66 → 3.0.0-dev.176

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.
Files changed (124) hide show
  1. package/README.md +12 -3
  2. package/lib/configs.browser.d.ts +2 -0
  3. package/lib/configs.browser.js +12 -0
  4. package/lib/configs.js +4 -1
  5. package/lib/index.d.ts +11 -1
  6. package/lib/ml-core.d.ts +24 -13
  7. package/lib/ml-core.js +16 -10
  8. package/lib/ml-dom/helper/accname.d.ts +2 -1
  9. package/lib/ml-dom/helper/accname.js +62 -2
  10. package/lib/ml-dom/helper/create-node.d.ts +7 -3
  11. package/lib/ml-dom/helper/create-node.js +4 -2
  12. package/lib/ml-dom/helper/debug.js +10 -5
  13. package/lib/ml-dom/helper/getIndent.d.ts +7 -7
  14. package/lib/ml-dom/helper/getIndent.js +18 -12
  15. package/lib/ml-dom/helper/walkers.d.ts +15 -5
  16. package/lib/ml-dom/helper/walkers.js +22 -16
  17. package/lib/ml-dom/index.d.ts +1 -0
  18. package/lib/ml-dom/manipulations/child-node-methods.d.ts +20 -7
  19. package/lib/ml-dom/manipulations/child-node-methods.js +24 -6
  20. package/lib/ml-dom/manipulations/get-children.d.ts +4 -2
  21. package/lib/ml-dom/manipulations/get-children.js +3 -1
  22. package/lib/ml-dom/node/attr.d.ts +94 -91
  23. package/lib/ml-dom/node/attr.js +26 -16
  24. package/lib/ml-dom/node/block.d.ts +36 -32
  25. package/lib/ml-dom/node/block.js +14 -4
  26. package/lib/ml-dom/node/character-data.d.ts +61 -54
  27. package/lib/ml-dom/node/character-data.js +9 -3
  28. package/lib/ml-dom/node/child-node.d.ts +10 -3
  29. package/lib/ml-dom/node/child-node.js +3 -1
  30. package/lib/ml-dom/node/comment.d.ts +16 -13
  31. package/lib/ml-dom/node/document-fragment.d.ts +24 -21
  32. package/lib/ml-dom/node/document-type.d.ts +35 -32
  33. package/lib/ml-dom/node/document-type.js +14 -4
  34. package/lib/ml-dom/node/document.d.ts +1608 -1545
  35. package/lib/ml-dom/node/document.js +125 -33
  36. package/lib/ml-dom/node/dom-token-list.d.ts +27 -27
  37. package/lib/ml-dom/node/dom-token-list.js +15 -13
  38. package/lib/ml-dom/node/element.d.ts +1906 -1817
  39. package/lib/ml-dom/node/element.js +345 -75
  40. package/lib/ml-dom/node/named-node-map.d.ts +45 -40
  41. package/lib/ml-dom/node/named-node-map.js +13 -5
  42. package/lib/ml-dom/node/node-list.d.ts +10 -4
  43. package/lib/ml-dom/node/node-list.js +25 -5
  44. package/lib/ml-dom/node/node-store.d.ts +10 -5
  45. package/lib/ml-dom/node/node-store.js +19 -1
  46. package/lib/ml-dom/node/node.d.ts +494 -467
  47. package/lib/ml-dom/node/node.js +89 -47
  48. package/lib/ml-dom/node/parent-node.d.ts +68 -59
  49. package/lib/ml-dom/node/parent-node.js +15 -6
  50. package/lib/ml-dom/node/rule-mapper.d.ts +9 -9
  51. package/lib/ml-dom/node/rule-mapper.js +11 -3
  52. package/lib/ml-dom/node/text.d.ts +50 -47
  53. package/lib/ml-dom/node/types.d.ts +94 -16
  54. package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -2
  55. package/lib/ml-dom/token/token.d.ts +44 -44
  56. package/lib/ml-rule/create-rule.d.ts +4 -2
  57. package/lib/ml-rule/create-test-rule.d.ts +6 -4
  58. package/lib/ml-rule/ml-rule-context.d.ts +58 -49
  59. package/lib/ml-rule/ml-rule-context.js +23 -4
  60. package/lib/ml-rule/ml-rule.d.ts +36 -26
  61. package/lib/ml-rule/ml-rule.js +39 -34
  62. package/lib/ml-rule/types.d.ts +35 -17
  63. package/lib/plugin/plugin.d.ts +3 -1
  64. package/lib/plugin/types.d.ts +9 -9
  65. package/lib/ruleset/index.d.ts +4 -4
  66. package/lib/ruleset/index.js +4 -4
  67. package/lib/test/index.d.ts +21 -8
  68. package/lib/test/index.js +6 -4
  69. package/lib/types.d.ts +12 -10
  70. package/lib/utils/get-location-from-chars.d.ts +9 -4
  71. package/package.json +21 -15
  72. package/test/ml-dom/helper/accname.spec.js +85 -0
  73. package/test/ml-dom/helper/create-node.spec.js +18 -0
  74. package/test/ml-dom/index.spec.js +680 -0
  75. package/lib/ml-dom/document.d.ts +0 -94
  76. package/lib/ml-dom/document.js +0 -273
  77. package/lib/ml-dom/helper/index.d.ts +0 -4
  78. package/lib/ml-dom/helper/index.js +0 -12
  79. package/lib/ml-dom/helper/mapped-nodes.d.ts +0 -52
  80. package/lib/ml-dom/helper/mapped-nodes.js +0 -2
  81. package/lib/ml-dom/helper/match-selector.d.ts +0 -20
  82. package/lib/ml-dom/helper/match-selector.js +0 -233
  83. package/lib/ml-dom/helper/node-store.d.ts +0 -12
  84. package/lib/ml-dom/helper/node-store.js +0 -28
  85. package/lib/ml-dom/helper/selector.d.ts +0 -11
  86. package/lib/ml-dom/helper/selector.js +0 -549
  87. package/lib/ml-dom/rule-mapper.d.ts +0 -16
  88. package/lib/ml-dom/rule-mapper.js +0 -57
  89. package/lib/ml-dom/tokens/abstract-element.d.ts +0 -54
  90. package/lib/ml-dom/tokens/abstract-element.js +0 -249
  91. package/lib/ml-dom/tokens/attribute.d.ts +0 -42
  92. package/lib/ml-dom/tokens/attribute.js +0 -85
  93. package/lib/ml-dom/tokens/comment.d.ts +0 -12
  94. package/lib/ml-dom/tokens/comment.js +0 -15
  95. package/lib/ml-dom/tokens/doctype.d.ts +0 -18
  96. package/lib/ml-dom/tokens/doctype.js +0 -32
  97. package/lib/ml-dom/tokens/element-close-tag.d.ts +0 -27
  98. package/lib/ml-dom/tokens/element-close-tag.js +0 -45
  99. package/lib/ml-dom/tokens/element.d.ts +0 -26
  100. package/lib/ml-dom/tokens/element.js +0 -66
  101. package/lib/ml-dom/tokens/index.d.ts +0 -10
  102. package/lib/ml-dom/tokens/index.js +0 -26
  103. package/lib/ml-dom/tokens/node.d.ts +0 -46
  104. package/lib/ml-dom/tokens/node.js +0 -126
  105. package/lib/ml-dom/tokens/omitted-element.d.ts +0 -13
  106. package/lib/ml-dom/tokens/omitted-element.js +0 -12
  107. package/lib/ml-dom/tokens/preprocessor-specific-attribute.d.ts +0 -24
  108. package/lib/ml-dom/tokens/preprocessor-specific-attribute.js +0 -37
  109. package/lib/ml-dom/tokens/preprocessor-specific-block.d.ts +0 -14
  110. package/lib/ml-dom/tokens/preprocessor-specific-block.js +0 -16
  111. package/lib/ml-dom/tokens/text.d.ts +0 -19
  112. package/lib/ml-dom/tokens/text.js +0 -26
  113. package/lib/ml-dom/tokens/token.d.ts +0 -16
  114. package/lib/ml-dom/tokens/token.js +0 -55
  115. package/lib/ml-dom/types.d.ts +0 -49
  116. package/lib/ml-dom/types.js +0 -2
  117. package/lib/selector/is-pure-html-element.d.ts +0 -1
  118. package/lib/selector/is-pure-html-element.js +0 -7
  119. package/lib/selector/match-selector.d.ts +0 -14
  120. package/lib/selector/match-selector.js +0 -230
  121. package/lib/selector/selector.d.ts +0 -9
  122. package/lib/selector/selector.js +0 -561
  123. package/tsconfig.test.json +0 -3
  124. package/tsconfig.tsbuildinfo +0 -1
@@ -1,475 +1,502 @@
1
- import type { RuleInfo } from '../..';
2
1
  import type { MLBlock } from './block';
3
2
  import type { MLChildNode } from './child-node';
4
3
  import type { MLDocument } from './document';
5
4
  import type { MLDocumentFragment } from './document-fragment';
6
5
  import type { MLElement } from './element';
7
6
  import type { MarkuplintPreprocessorBlockType, NodeType, NodeTypeOf } from './types';
8
- import type { MLASTAbstructNode } from '@markuplint/ml-ast';
9
- import type { AnyRule, RuleConfigValue } from '@markuplint/ml-config';
7
+ import type { RuleInfo } from '../..';
8
+ import type { MLASTAbstractNode } from '@markuplint/ml-ast';
9
+ import type { AnyRule, PlainData, RuleConfigValue } from '@markuplint/ml-config';
10
10
  import { MLToken } from '../token/token';
11
- export declare abstract class MLNode<T extends RuleConfigValue, O = null, A extends MLASTAbstructNode = MLASTAbstructNode> extends MLToken<A> implements Node {
12
- #private;
13
- /**
14
- * @implements DOM API: `Node`
15
- * @see https://dom.spec.whatwg.org/#interface-node
16
- */
17
- readonly ATTRIBUTE_NODE = 2;
18
- /**
19
- * @implements DOM API: `Node`
20
- * @see https://dom.spec.whatwg.org/#interface-node
21
- */
22
- readonly CDATA_SECTION_NODE = 4;
23
- /**
24
- * @implements DOM API: `Node`
25
- * @see https://dom.spec.whatwg.org/#interface-node
26
- */
27
- readonly COMMENT_NODE = 8;
28
- /**
29
- * @implements DOM API: `Node`
30
- * @see https://dom.spec.whatwg.org/#interface-node
31
- */
32
- readonly DOCUMENT_FRAGMENT_NODE = 11;
33
- /**
34
- * @implements DOM API: `Node`
35
- * @see https://dom.spec.whatwg.org/#interface-node
36
- */
37
- readonly DOCUMENT_NODE = 9;
38
- /**
39
- * @implements DOM API: `Node`
40
- * @see https://dom.spec.whatwg.org/#dom-node-document_position_contained_by
41
- */
42
- readonly DOCUMENT_POSITION_CONTAINED_BY = 16;
43
- /**
44
- * @implements DOM API: `Node`
45
- * @see https://dom.spec.whatwg.org/#dom-node-document_position_contains
46
- */
47
- readonly DOCUMENT_POSITION_CONTAINS = 8;
48
- /**
49
- * @implements DOM API: `Node`
50
- * @see https://dom.spec.whatwg.org/#dom-node-document_position_disconnected
51
- */
52
- readonly DOCUMENT_POSITION_DISCONNECTED = 1;
53
- /**
54
- * @implements DOM API: `Node`
55
- * @see https://dom.spec.whatwg.org/#dom-node-document_position_following
56
- */
57
- readonly DOCUMENT_POSITION_FOLLOWING = 4;
58
- /**
59
- * @implements DOM API: `Node`
60
- * @see https://dom.spec.whatwg.org/#dom-node-document_position_implementation_specific
61
- */
62
- readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
63
- /**
64
- * @implements DOM API: `Node`
65
- * @see https://dom.spec.whatwg.org/#dom-node-document_position_preceding
66
- */
67
- readonly DOCUMENT_POSITION_PRECEDING = 2;
68
- /**
69
- * @implements DOM API: `Node`
70
- * @see https://dom.spec.whatwg.org/#interface-node
71
- */
72
- readonly DOCUMENT_TYPE_NODE = 10;
73
- /**
74
- * @implements DOM API: `Node`
75
- * @see https://dom.spec.whatwg.org/#interface-node
76
- */
77
- readonly ELEMENT_NODE = 1;
78
- /**
79
- * @deprecated
80
- * @implements DOM API: `Node`
81
- * @see https://dom.spec.whatwg.org/#interface-node
82
- */
83
- readonly ENTITY_NODE = 6;
84
- /**
85
- * @deprecated
86
- * @implements DOM API: `Node`
87
- * @see https://dom.spec.whatwg.org/#interface-node
88
- */
89
- readonly ENTITY_REFERENCE_NODE = 5;
90
- /**
91
- * @implements `@markuplint/ml-core` API: `MLNode`
92
- */
93
- readonly MARKUPLINT_PREPROCESSOR_BLOCK: MarkuplintPreprocessorBlockType;
94
- /**
95
- * @deprecated
96
- * @implements DOM API: `Node`
97
- * @see https://dom.spec.whatwg.org/#interface-node
98
- */
99
- readonly NOTATION_NODE = 12;
100
- /**
101
- * @implements DOM API: `Node`
102
- * @see https://dom.spec.whatwg.org/#interface-node
103
- */
104
- readonly PROCESSING_INSTRUCTION_NODE = 7;
105
- readonly rules: Record<string, AnyRule>;
106
- /**
107
- * @implements DOM API: `Node`
108
- * @see https://dom.spec.whatwg.org/#interface-node
109
- */
110
- readonly TEXT_NODE = 3;
111
- protected _astToken: A;
112
- /**
113
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
114
- *
115
- * @unsupported
116
- * @implements DOM API: `Node`
117
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-baseuri%E2%91%A0
118
- */
119
- get baseURI(): string;
120
- /**
121
- * The list of child nodes that contains `Element`, `Text`, and `Comment`.
122
- *
123
- * @readonly
124
- * @implements DOM API: `Node`
125
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-childnodes%E2%91%A0
126
- */
127
- get childNodes(): NodeListOf<MLChildNode<T, O>>;
128
- /**
129
- * The first node that may be `Element`, `Text`, and `CommentNode`.
130
- *
131
- * @readonly
132
- * @implements DOM API: `Node`
133
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-firstchild%E2%91%A0
134
- */
135
- get firstChild(): MLChildNode<T, O>;
136
- /**
137
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
138
- *
139
- * @unsupported
140
- * @implements DOM API: `Node`
141
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-isconnected%E2%91%A0
142
- */
143
- get isConnected(): boolean;
144
- /**
145
- * The last node that may be `Element`, `Text`, and `CommentNode`.
146
- *
147
- * @readonly
148
- * @implements DOM API: `Node`
149
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-lastchild%E2%91%A0
150
- */
151
- get lastChild(): MLChildNode<T, O>;
152
- /**
153
- * @implements `@markuplint/ml-core` API: `MLNode`
154
- */
155
- get nextNode(): MLNode<T, O> | null;
156
- /**
157
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
158
- *
159
- * @unsupported
160
- * @implements DOM API: `Node`
161
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-nextsibling%E2%91%A0
162
- */
163
- get nextSibling(): ChildNode | null;
164
- /**
165
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
166
- *
167
- * It must not call from the instance of the `MLNode` class.
168
- *
169
- * @implements DOM API: `Node`
170
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-nodename%E2%91%A0
171
- */
172
- get nodeName(): string;
173
- /**
174
- * @implements DOM API: `Node`
175
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-nodetype%E2%91%A0
176
- */
177
- get nodeType(): NodeType | -1;
178
- /**
179
- * The nodeValue getter steps are to return the following, switching on the interface this implements:
180
- *
181
- * - `Attr`: this’s value.
182
- * - `CharacterData`: this’s data.
183
- * - _Otherwise_: Null.
184
- *
185
- * @implements DOM API: `Node`
186
- * @see https://dom.spec.whatwg.org/#dom-node-nodevalue
187
- */
188
- get nodeValue(): string | null;
189
- /**
190
- * The `Document` that this node belongs to.
191
- *
192
- * @deprecated
193
- * @implements DOM API: `Node`
194
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-ownerdocument%E2%91%A0
195
- */
196
- get ownerDocument(): any;
197
- get ownerMLDocument(): MLDocument<T, O>;
198
- /**
199
- * The parent element.
200
- *
201
- * @implements DOM API: `Node`
202
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-parentelement%E2%91%A0
203
- */
204
- get parentElement(): MLElement<T, O> | null;
205
- /**
206
- * The parent node that may be `Element`, `Document`, `DocumentFragment`, and `null`.
207
- *
208
- * ## HTML:
209
- *
210
- * ```html
211
- * <html> // => #document
212
- * <body></body> // => <html>
213
- * </html>
214
- * ```
215
- *
216
- * ---
217
- *
218
- * ```html
219
- * <div> // => null
220
- * <span></span> // => <div>
221
- * </div>
222
- * ```
223
- *
224
- * ## JSX:
225
- *
226
- * ```jsx
227
- * <> // => null
228
- * <div> // => #document-fragment
229
- * {items.map(item => {
230
- * return (
231
- * <span /> // => null
232
- * )
233
- * })}
234
- * </div>
235
- * </>
236
- * ```
237
- *
238
- * ## Pug
239
- *
240
- * ```jade
241
- * //- null
242
- * div
243
- * //- <div>
244
- * if foo
245
- * //- null
246
- * span
247
- * ```
248
- *
249
- * @implements DOM API: `Node`
250
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-parentnode%E2%91%A0
251
- */
252
- get parentNode(): MLDocument<any, any> | MLDocumentFragment<any, any> | MLElement<T, O> | null;
253
- /**
254
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
255
- *
256
- * @unsupported
257
- * @implements DOM API: `Node`
258
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-previoussibling%E2%91%A0
259
- */
260
- get previousSibling(): ChildNode | null;
261
- /**
262
- * @implements `@markuplint/ml-core` API: `MLNode`
263
- */
264
- get prevNode(): MLNode<T, O> | null;
265
- /**
266
- * @implements `@markuplint/ml-core` API: `MLNode`
267
- */
268
- get prevToken(): MLNode<T, O> | null;
269
- /**
270
- * @implements `@markuplint/ml-core` API: `MLNode`
271
- */
272
- get rule(): RuleInfo<T, O>;
273
- /**
274
- * Returns a syntaxical parent node
275
- *
276
- * ## HTML:
277
- *
278
- * ```html
279
- * <html> // => #document
280
- * <body></body> // => <html>
281
- * </html>
282
- * ```
283
- *
284
- * ## JSX:
285
- *
286
- * ```jsx
287
- * <> // => #document
288
- * <div> // => #document-fragment
289
- * {items.map(item => {
290
- * return (
291
- * <span /> // => #ml-block
292
- * )
293
- * })}
294
- * </div>
295
- * </>
296
- * ```
297
- *
298
- * ## Pug
299
- *
300
- * ```jade
301
- * //- #document
302
- * div
303
- * //- <div>
304
- * if foo
305
- * //- #ml-block
306
- * span
307
- * ```
308
- *
309
- * @implements `@markuplint/ml-core` API: `MLNode`
310
- */
311
- get syntaxicalParentNode(): MLDocument<any, any> | MLDocumentFragment<any, any> | MLElement<T, O> | MLBlock<T, O> | null;
312
- /**
313
- * Return the text content.
314
- *
315
- * - If the node is a `Comment`, or `Text`, textContent returns, or sets, the text inside the node, i.e., the Node.nodeValue.
316
- * - For other node types, textContent returns the concatenation of the textContent of every child node, excluding comments and processing instructions. (This is an empty string if the node has no children.)
317
- *
318
- * @implements DOM API: `Node`
319
- * @see https://dom.spec.whatwg.org/#dom-node-textcontent
320
- */
321
- get textContent(): string | null;
322
- constructor(astNode: A, document: MLDocument<T, O>);
323
- /**
324
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
325
- *
326
- * @unsupported
327
- * @implements DOM API: `EventTarget`
328
- * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-addeventlistener%E2%91%A2
329
- */
330
- addEventListener(type: string, callback?: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
331
- /**
332
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
333
- *
334
- * @unsupported
335
- * @implements DOM API: `Node`
336
- * @see https://dom.spec.whatwg.org/#dom-node-appendchild
337
- */
338
- appendChild<T extends Node>(node: T): T;
339
- /**
340
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
341
- *
342
- * @unsupported
343
- * @implements DOM API: `Node`
344
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-clonenode%E2%91%A0
345
- */
346
- cloneNode(deep?: boolean): Node;
347
- /**
348
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
349
- *
350
- * @unsupported
351
- * @implements DOM API: `Node`
352
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-comparedocumentposition%E2%91%A0
353
- */
354
- compareDocumentPosition(other: Node): number;
355
- /**
356
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
357
- *
358
- * @unsupported
359
- * @implements DOM API: `Node`
360
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-contains%E2%91%A0
361
- */
362
- contains(other: Node | null): boolean;
363
- /**
364
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
365
- *
366
- * @unsupported
367
- * @implements DOM API: `EventTarget`
368
- * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-dispatchevent%E2%91%A2
369
- */
370
- dispatchEvent(event: Event): boolean;
371
- /**
372
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
373
- *
374
- * @unsupported
375
- * @implements DOM API: `Node`
376
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-getrootnode%E2%91%A0
377
- */
378
- getRootNode(options?: GetRootNodeOptions): MLNode<T, O>;
379
- /**
380
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
381
- *
382
- * @unsupported
383
- * @implements DOM API: `Node`
384
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-haschildnodes%E2%91%A0
385
- */
386
- hasChildNodes(): boolean;
387
- /**
388
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
389
- *
390
- * @unsupported
391
- * @implements DOM API: `Node`
392
- * @see https://dom.spec.whatwg.org/#dom-node-insertbefore
393
- */
394
- insertBefore<T extends Node>(node: T, child: Node | null): T;
395
- /**
396
- * @implements `@markuplint/ml-core` API: `MLNode`
397
- */
398
- is<NType extends NodeType>(nodeType: NType): this is NodeTypeOf<NType, T, O>;
399
- /**
400
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
401
- *
402
- * @unsupported
403
- * @implements DOM API: `Node`
404
- * @see https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
405
- */
406
- isDefaultNamespace(namespace: string | null): boolean;
407
- /**
408
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
409
- *
410
- * @unsupported
411
- * @implements DOM API: `Node`
412
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-isequalnode%E2%91%A0
413
- */
414
- isEqualNode(otherNode: Node | null): boolean;
415
- /**
416
- * @implements `@markuplint/ml-core` API: `MLNode`
417
- */
418
- isInFragmentDocument(): boolean;
419
- /**
420
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
421
- *
422
- * @unsupported
423
- * @implements DOM API: `Node`
424
- * @see https://dom.spec.whatwg.org/#dom-node-issamenode
425
- */
426
- isSameNode(otherNode: Node | null): boolean;
427
- /**
428
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
429
- *
430
- * @unsupported
431
- * @implements DOM API: `Node`
432
- * @see https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri
433
- */
434
- lookupNamespaceURI(prefix: string | null): string | null;
435
- /**
436
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
437
- *
438
- * @unsupported
439
- * @implements DOM API: `Node`
440
- * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
441
- */
442
- lookupPrefix(namespace: string | null): string | null;
443
- /**
444
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
445
- *
446
- * @unsupported
447
- * @implements DOM API: `Node`
448
- * @see https://dom.spec.whatwg.org/#ref-for-dom-node-normalize%E2%91%A0
449
- */
450
- normalize(): void;
451
- /**
452
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
453
- *
454
- * @unsupported
455
- * @implements DOM API: `Node`
456
- * @see https://dom.spec.whatwg.org/#dom-node-removechild
457
- */
458
- removeChild<T extends Node>(child: T): T;
459
- /**
460
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
461
- *
462
- * @unsupported
463
- * @implements DOM API: `EventTarget`
464
- * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-removeeventlistener%E2%91%A1
465
- */
466
- removeEventListener(type: string, callback?: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
467
- /**
468
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
469
- *
470
- * @unsupported
471
- * @implements DOM API: `Node`
472
- * @see https://dom.spec.whatwg.org/#dom-node-replacechild
473
- */
474
- replaceChild<T extends Node>(node: Node, child: T): T;
11
+ export declare abstract class MLNode<
12
+ T extends RuleConfigValue,
13
+ O extends PlainData = undefined,
14
+ A extends MLASTAbstractNode = MLASTAbstractNode,
15
+ >
16
+ extends MLToken<A>
17
+ implements Node
18
+ {
19
+ #private;
20
+ /**
21
+ * @implements DOM API: `Node`
22
+ * @see https://dom.spec.whatwg.org/#interface-node
23
+ */
24
+ readonly ATTRIBUTE_NODE = 2;
25
+ /**
26
+ * @implements DOM API: `Node`
27
+ * @see https://dom.spec.whatwg.org/#interface-node
28
+ */
29
+ readonly CDATA_SECTION_NODE = 4;
30
+ /**
31
+ * @implements DOM API: `Node`
32
+ * @see https://dom.spec.whatwg.org/#interface-node
33
+ */
34
+ readonly COMMENT_NODE = 8;
35
+ /**
36
+ * @implements DOM API: `Node`
37
+ * @see https://dom.spec.whatwg.org/#interface-node
38
+ */
39
+ readonly DOCUMENT_FRAGMENT_NODE = 11;
40
+ /**
41
+ * @implements DOM API: `Node`
42
+ * @see https://dom.spec.whatwg.org/#interface-node
43
+ */
44
+ readonly DOCUMENT_NODE = 9;
45
+ /**
46
+ * @implements DOM API: `Node`
47
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_contained_by
48
+ */
49
+ readonly DOCUMENT_POSITION_CONTAINED_BY = 16;
50
+ /**
51
+ * @implements DOM API: `Node`
52
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_contains
53
+ */
54
+ readonly DOCUMENT_POSITION_CONTAINS = 8;
55
+ /**
56
+ * @implements DOM API: `Node`
57
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_disconnected
58
+ */
59
+ readonly DOCUMENT_POSITION_DISCONNECTED = 1;
60
+ /**
61
+ * @implements DOM API: `Node`
62
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_following
63
+ */
64
+ readonly DOCUMENT_POSITION_FOLLOWING = 4;
65
+ /**
66
+ * @implements DOM API: `Node`
67
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_implementation_specific
68
+ */
69
+ readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
70
+ /**
71
+ * @implements DOM API: `Node`
72
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_preceding
73
+ */
74
+ readonly DOCUMENT_POSITION_PRECEDING = 2;
75
+ /**
76
+ * @implements DOM API: `Node`
77
+ * @see https://dom.spec.whatwg.org/#interface-node
78
+ */
79
+ readonly DOCUMENT_TYPE_NODE = 10;
80
+ /**
81
+ * @implements DOM API: `Node`
82
+ * @see https://dom.spec.whatwg.org/#interface-node
83
+ */
84
+ readonly ELEMENT_NODE = 1;
85
+ /**
86
+ * @deprecated
87
+ * @implements DOM API: `Node`
88
+ * @see https://dom.spec.whatwg.org/#interface-node
89
+ */
90
+ readonly ENTITY_NODE = 6;
91
+ /**
92
+ * @deprecated
93
+ * @implements DOM API: `Node`
94
+ * @see https://dom.spec.whatwg.org/#interface-node
95
+ */
96
+ readonly ENTITY_REFERENCE_NODE = 5;
97
+ /**
98
+ * @implements `@markuplint/ml-core` API: `MLNode`
99
+ */
100
+ readonly MARKUPLINT_PREPROCESSOR_BLOCK: MarkuplintPreprocessorBlockType;
101
+ /**
102
+ * @deprecated
103
+ * @implements DOM API: `Node`
104
+ * @see https://dom.spec.whatwg.org/#interface-node
105
+ */
106
+ readonly NOTATION_NODE = 12;
107
+ /**
108
+ * @implements DOM API: `Node`
109
+ * @see https://dom.spec.whatwg.org/#interface-node
110
+ */
111
+ readonly PROCESSING_INSTRUCTION_NODE = 7;
112
+ /**
113
+ * @implements DOM API: `Node`
114
+ * @see https://dom.spec.whatwg.org/#interface-node
115
+ */
116
+ readonly TEXT_NODE = 3;
117
+ /**
118
+ *
119
+ */
120
+ readonly rules: Record<string, AnyRule>;
121
+ protected _astToken: A;
122
+ constructor(astNode: A, document: MLDocument<T, O>);
123
+ /**
124
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
125
+ *
126
+ * @unsupported
127
+ * @implements DOM API: `Node`
128
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-baseuri%E2%91%A0
129
+ */
130
+ get baseURI(): string;
131
+ /**
132
+ * The list of child nodes that contains `Element`, `Text`, and `Comment`.
133
+ *
134
+ * @readonly
135
+ * @implements DOM API: `Node`
136
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-childnodes%E2%91%A0
137
+ */
138
+ get childNodes(): NodeListOf<MLChildNode<T, O>>;
139
+ /**
140
+ * The first node that may be `Element`, `Text`, and `CommentNode`.
141
+ *
142
+ * @readonly
143
+ * @implements DOM API: `Node`
144
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-firstchild%E2%91%A0
145
+ */
146
+ get firstChild(): MLChildNode<T, O> | null;
147
+ /**
148
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
149
+ *
150
+ * @unsupported
151
+ * @implements DOM API: `Node`
152
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-isconnected%E2%91%A0
153
+ */
154
+ get isConnected(): boolean;
155
+ /**
156
+ * The last node that may be `Element`, `Text`, and `CommentNode`.
157
+ *
158
+ * @readonly
159
+ * @implements DOM API: `Node`
160
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-lastchild%E2%91%A0
161
+ */
162
+ get lastChild(): MLChildNode<T, O> | null;
163
+ /**
164
+ * @implements `@markuplint/ml-core` API: `MLNode`
165
+ */
166
+ get nextNode(): MLNode<T, O> | null;
167
+ /**
168
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
169
+ *
170
+ * @unsupported
171
+ * @implements DOM API: `Node`
172
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-nextsibling%E2%91%A0
173
+ */
174
+ get nextSibling(): ChildNode | null;
175
+ /**
176
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
177
+ *
178
+ * It must not call from the instance of the `MLNode` class.
179
+ *
180
+ * @implements DOM API: `Node`
181
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-nodename%E2%91%A0
182
+ */
183
+ get nodeName(): string;
184
+ /**
185
+ * @implements DOM API: `Node`
186
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-nodetype%E2%91%A0
187
+ */
188
+ get nodeType(): NodeType | -1;
189
+ /**
190
+ * The nodeValue getter steps are to return the following, switching on the interface this implements:
191
+ *
192
+ * - `Attr`: this’s value.
193
+ * - `CharacterData`: this’s data.
194
+ * - _Otherwise_: Null.
195
+ *
196
+ * @implements DOM API: `Node`
197
+ * @see https://dom.spec.whatwg.org/#dom-node-nodevalue
198
+ */
199
+ get nodeValue(): string | null;
200
+ /**
201
+ * The `Document` that this node belongs to.
202
+ *
203
+ * @deprecated
204
+ * @implements DOM API: `Node`
205
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-ownerdocument%E2%91%A0
206
+ */
207
+ get ownerDocument(): any;
208
+ get ownerMLDocument(): MLDocument<T, O>;
209
+ /**
210
+ * The parent element.
211
+ *
212
+ * @implements DOM API: `Node`
213
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-parentelement%E2%91%A0
214
+ */
215
+ get parentElement(): MLElement<T, O> | null;
216
+ /**
217
+ * The parent node that may be `Element`, `Document`, `DocumentFragment`, and `null`.
218
+ *
219
+ * ## HTML:
220
+ *
221
+ * ```html
222
+ * <html> // => #document
223
+ * <body></body> // => <html>
224
+ * </html>
225
+ * ```
226
+ *
227
+ * ---
228
+ *
229
+ * ```html
230
+ * <div> // => null
231
+ * <span></span> // => <div>
232
+ * </div>
233
+ * ```
234
+ *
235
+ * ## JSX:
236
+ *
237
+ * ```jsx
238
+ * <> // => null
239
+ * <div> // => #document-fragment
240
+ * {items.map(item => {
241
+ * return (
242
+ * <span /> // => null
243
+ * )
244
+ * })}
245
+ * </div>
246
+ * </>
247
+ * ```
248
+ *
249
+ * ## Pug
250
+ *
251
+ * ```jade
252
+ * //- null
253
+ * div
254
+ * //- <div>
255
+ * if foo
256
+ * //- null
257
+ * span
258
+ * ```
259
+ *
260
+ * @implements DOM API: `Node`
261
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-parentnode%E2%91%A0
262
+ */
263
+ get parentNode(): MLDocument<any, any> | MLDocumentFragment<any, any> | MLElement<T, O> | null;
264
+ /**
265
+ * @implements `@markuplint/ml-core` API: `MLNode`
266
+ */
267
+ get prevNode(): MLNode<T, O> | null;
268
+ /**
269
+ * @implements `@markuplint/ml-core` API: `MLNode`
270
+ */
271
+ get prevToken(): MLNode<T, O> | null;
272
+ /**
273
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
274
+ *
275
+ * @unsupported
276
+ * @implements DOM API: `Node`
277
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-previoussibling%E2%91%A0
278
+ */
279
+ get previousSibling(): ChildNode | null;
280
+ /**
281
+ * @implements `@markuplint/ml-core` API: `MLNode`
282
+ */
283
+ get rule(): RuleInfo<T, O>;
284
+ /**
285
+ * Returns a syntactical parent node
286
+ *
287
+ * ## HTML:
288
+ *
289
+ * ```html
290
+ * <html> // => #document
291
+ * <body></body> // => <html>
292
+ * </html>
293
+ * ```
294
+ *
295
+ * ## JSX:
296
+ *
297
+ * ```jsx
298
+ * <> // => #document
299
+ * <div> // => #document-fragment
300
+ * {items.map(item => {
301
+ * return (
302
+ * <span /> // => #ml-block
303
+ * )
304
+ * })}
305
+ * </div>
306
+ * </>
307
+ * ```
308
+ *
309
+ * ## Pug
310
+ *
311
+ * ```jade
312
+ * //- #document
313
+ * div
314
+ * //- <div>
315
+ * if foo
316
+ * //- #ml-block
317
+ * span
318
+ * ```
319
+ *
320
+ * @implements `@markuplint/ml-core` API: `MLNode`
321
+ */
322
+ get syntacticalParentNode():
323
+ | MLDocument<any, any>
324
+ | MLDocumentFragment<any, any>
325
+ | MLElement<T, O>
326
+ | MLBlock<T, O>
327
+ | null;
328
+ /**
329
+ * Return the text content.
330
+ *
331
+ * - If the node is a `Comment`, or `Text`, textContent returns, or sets, the text inside the node, i.e., the Node.nodeValue.
332
+ * - For other node types, textContent returns the concatenation of the textContent of every child node, excluding comments and processing instructions. (This is an empty string if the node has no children.)
333
+ *
334
+ * @implements DOM API: `Node`
335
+ * @see https://dom.spec.whatwg.org/#dom-node-textcontent
336
+ */
337
+ get textContent(): string | null;
338
+ /**
339
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
340
+ *
341
+ * @unsupported
342
+ * @implements DOM API: `EventTarget`
343
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-addeventlistener%E2%91%A2
344
+ */
345
+ addEventListener(
346
+ type: string,
347
+ callback?: EventListenerOrEventListenerObject | null,
348
+ options?: AddEventListenerOptions | boolean,
349
+ ): void;
350
+ /**
351
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
352
+ *
353
+ * @unsupported
354
+ * @implements DOM API: `Node`
355
+ * @see https://dom.spec.whatwg.org/#dom-node-appendchild
356
+ */
357
+ appendChild<T extends Node>(node: T): T;
358
+ /**
359
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
360
+ *
361
+ * @unsupported
362
+ * @implements DOM API: `Node`
363
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-clonenode%E2%91%A0
364
+ */
365
+ cloneNode(deep?: boolean): Node;
366
+ /**
367
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
368
+ *
369
+ * @unsupported
370
+ * @implements DOM API: `Node`
371
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-comparedocumentposition%E2%91%A0
372
+ */
373
+ compareDocumentPosition(other: Node): number;
374
+ /**
375
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
376
+ *
377
+ * @unsupported
378
+ * @implements DOM API: `Node`
379
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-contains%E2%91%A0
380
+ */
381
+ contains(other: Node | null): boolean;
382
+ /**
383
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
384
+ *
385
+ * @unsupported
386
+ * @implements DOM API: `EventTarget`
387
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-dispatchevent%E2%91%A2
388
+ */
389
+ dispatchEvent(event: Event): boolean;
390
+ /**
391
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
392
+ *
393
+ * @unsupported
394
+ * @implements DOM API: `Node`
395
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-getrootnode%E2%91%A0
396
+ */
397
+ getRootNode(options?: GetRootNodeOptions): MLNode<T, O>;
398
+ /**
399
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
400
+ *
401
+ * @unsupported
402
+ * @implements DOM API: `Node`
403
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-haschildnodes%E2%91%A0
404
+ */
405
+ hasChildNodes(): boolean;
406
+ /**
407
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
408
+ *
409
+ * @unsupported
410
+ * @implements DOM API: `Node`
411
+ * @see https://dom.spec.whatwg.org/#dom-node-insertbefore
412
+ */
413
+ insertBefore<T extends Node>(node: T, child: Node | null): T;
414
+ /**
415
+ * @implements `@markuplint/ml-core` API: `MLNode`
416
+ */
417
+ is<NType extends NodeType>(nodeType: NType): this is NodeTypeOf<NType, T, O>;
418
+ /**
419
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
420
+ *
421
+ * @unsupported
422
+ * @implements DOM API: `Node`
423
+ * @see https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
424
+ */
425
+ isDefaultNamespace(namespace: string | null): boolean;
426
+ /**
427
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
428
+ *
429
+ * @unsupported
430
+ * @implements DOM API: `Node`
431
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-isequalnode%E2%91%A0
432
+ */
433
+ isEqualNode(otherNode: Node | null): boolean;
434
+ /**
435
+ * @implements `@markuplint/ml-core` API: `MLNode`
436
+ */
437
+ isInFragmentDocument(): boolean;
438
+ /**
439
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
440
+ *
441
+ * @unsupported
442
+ * @implements DOM API: `Node`
443
+ * @see https://dom.spec.whatwg.org/#dom-node-issamenode
444
+ */
445
+ isSameNode(otherNode: Node | null): boolean;
446
+ /**
447
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
448
+ *
449
+ * @unsupported
450
+ * @implements DOM API: `Node`
451
+ * @see https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri
452
+ */
453
+ lookupNamespaceURI(prefix: string | null): string | null;
454
+ /**
455
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
456
+ *
457
+ * @unsupported
458
+ * @implements DOM API: `Node`
459
+ * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
460
+ */
461
+ lookupPrefix(namespace: string | null): string | null;
462
+ /**
463
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
464
+ *
465
+ * @unsupported
466
+ * @implements DOM API: `Node`
467
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-normalize%E2%91%A0
468
+ */
469
+ normalize(): void;
470
+ /**
471
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
472
+ *
473
+ * @unsupported
474
+ * @implements DOM API: `Node`
475
+ * @see https://dom.spec.whatwg.org/#dom-node-removechild
476
+ */
477
+ removeChild<T extends Node>(child: T): T;
478
+ /**
479
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
480
+ *
481
+ * @unsupported
482
+ * @implements DOM API: `EventTarget`
483
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-removeeventlistener%E2%91%A1
484
+ */
485
+ removeEventListener(
486
+ type: string,
487
+ callback?: EventListenerOrEventListenerObject | null,
488
+ options?: EventListenerOptions | boolean,
489
+ ): void;
490
+ /**
491
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
492
+ *
493
+ * @unsupported
494
+ * @implements DOM API: `Node`
495
+ * @see https://dom.spec.whatwg.org/#dom-node-replacechild
496
+ */
497
+ replaceChild<T extends Node>(node: Node, child: T): T;
498
+ /**
499
+ * @implements `@markuplint/ml-core` API: `MLNode`
500
+ */
501
+ resetChildren(childNodes?: NodeListOf<MLChildNode<T, O>>): void;
475
502
  }