@markuplint/ml-core 2.3.0 → 2.3.1

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 (55) hide show
  1. package/lib/ml-core.d.ts +1 -1
  2. package/lib/ml-dom/helper/selector.d.ts +1 -1
  3. package/lib/ml-dom/manipulations/child-node-methods.d.ts +33 -0
  4. package/lib/ml-dom/manipulations/child-node-methods.js +73 -0
  5. package/lib/ml-dom/manipulations/get-children.d.ts +4 -0
  6. package/lib/ml-dom/manipulations/get-children.js +10 -0
  7. package/lib/ml-dom/node/attr.d.ts +93 -0
  8. package/lib/ml-dom/node/attr.js +144 -0
  9. package/lib/ml-dom/node/block.d.ts +38 -0
  10. package/lib/ml-dom/node/block.js +53 -0
  11. package/lib/ml-dom/node/character-data.d.ts +57 -0
  12. package/lib/ml-dom/node/character-data.js +87 -0
  13. package/lib/ml-dom/node/child-node.d.ts +9 -0
  14. package/lib/ml-dom/node/child-node.js +10 -0
  15. package/lib/ml-dom/node/comment.d.ts +17 -0
  16. package/lib/ml-dom/node/comment.js +24 -0
  17. package/lib/ml-dom/node/document-fragment.d.ts +24 -0
  18. package/lib/ml-dom/node/document-fragment.js +33 -0
  19. package/lib/ml-dom/node/document-type.d.ts +38 -0
  20. package/lib/ml-dom/node/document-type.js +52 -0
  21. package/lib/ml-dom/node/document.d.ts +1554 -0
  22. package/lib/ml-dom/node/document.js +2117 -0
  23. package/lib/ml-dom/node/dom-token-list.d.ts +15 -0
  24. package/lib/ml-dom/node/dom-token-list.js +61 -0
  25. package/lib/ml-dom/node/element.d.ts +1832 -0
  26. package/lib/ml-dom/node/element.js +2483 -0
  27. package/lib/ml-dom/node/named-node-map.d.ts +42 -0
  28. package/lib/ml-dom/node/named-node-map.js +64 -0
  29. package/lib/ml-dom/node/node-list.d.ts +6 -0
  30. package/lib/ml-dom/node/node-list.js +39 -0
  31. package/lib/ml-dom/node/node-store.d.ts +14 -0
  32. package/lib/ml-dom/node/node-store.js +32 -0
  33. package/lib/ml-dom/node/node.d.ts +475 -0
  34. package/lib/ml-dom/node/node.js +672 -0
  35. package/lib/ml-dom/node/parent-node.d.ts +66 -0
  36. package/lib/ml-dom/node/parent-node.js +131 -0
  37. package/lib/ml-dom/node/rule-mapper.d.ts +17 -0
  38. package/lib/ml-dom/node/rule-mapper.js +49 -0
  39. package/lib/ml-dom/node/text.d.ts +51 -0
  40. package/lib/ml-dom/node/text.js +76 -0
  41. package/lib/ml-dom/node/types.d.ts +25 -0
  42. package/lib/ml-dom/node/types.js +2 -0
  43. package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -0
  44. package/lib/ml-dom/node/unexpected-call-error.js +5 -0
  45. package/lib/ml-dom/token/token.d.ts +47 -0
  46. package/lib/ml-dom/token/token.js +89 -0
  47. package/lib/selector/is-pure-html-element.d.ts +1 -0
  48. package/lib/selector/is-pure-html-element.js +7 -0
  49. package/lib/selector/match-selector.d.ts +14 -0
  50. package/lib/selector/match-selector.js +230 -0
  51. package/lib/selector/selector.d.ts +9 -0
  52. package/lib/selector/selector.js +561 -0
  53. package/lib/utils/get-location-from-chars.d.ts +9 -4
  54. package/package.json +3 -3
  55. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,672 @@
1
+ "use strict";
2
+ var _MLNode_childNodes, _MLNode_ownerDocument, _MLNode_prevToken;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MLNode = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const token_1 = require("../token/token");
7
+ const child_node_1 = require("./child-node");
8
+ const node_list_1 = require("./node-list");
9
+ const node_store_1 = require("./node-store");
10
+ const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
11
+ class MLNode extends token_1.MLToken {
12
+ constructor(astNode, document) {
13
+ super(astNode);
14
+ /**
15
+ * Cached `childNodes` property
16
+ */
17
+ _MLNode_childNodes.set(this, void 0);
18
+ /**
19
+ * Owner `Document`
20
+ *
21
+ * @implements DOM API: `Node`
22
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-ownerdocument
23
+ */
24
+ _MLNode_ownerDocument.set(this, void 0);
25
+ /**
26
+ * Cached `prevToken` property
27
+ */
28
+ _MLNode_prevToken.set(this, void 0);
29
+ /**
30
+ * @implements DOM API: `Node`
31
+ * @see https://dom.spec.whatwg.org/#interface-node
32
+ */
33
+ this.ATTRIBUTE_NODE = 2;
34
+ /**
35
+ * @implements DOM API: `Node`
36
+ * @see https://dom.spec.whatwg.org/#interface-node
37
+ */
38
+ this.CDATA_SECTION_NODE = 4;
39
+ /**
40
+ * @implements DOM API: `Node`
41
+ * @see https://dom.spec.whatwg.org/#interface-node
42
+ */
43
+ this.COMMENT_NODE = 8;
44
+ /**
45
+ * @implements DOM API: `Node`
46
+ * @see https://dom.spec.whatwg.org/#interface-node
47
+ */
48
+ this.DOCUMENT_FRAGMENT_NODE = 11;
49
+ /**
50
+ * @implements DOM API: `Node`
51
+ * @see https://dom.spec.whatwg.org/#interface-node
52
+ */
53
+ this.DOCUMENT_NODE = 9;
54
+ /**
55
+ * @implements DOM API: `Node`
56
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_contained_by
57
+ */
58
+ this.DOCUMENT_POSITION_CONTAINED_BY = 16;
59
+ /**
60
+ * @implements DOM API: `Node`
61
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_contains
62
+ */
63
+ this.DOCUMENT_POSITION_CONTAINS = 8;
64
+ /**
65
+ * @implements DOM API: `Node`
66
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_disconnected
67
+ */
68
+ this.DOCUMENT_POSITION_DISCONNECTED = 0b1;
69
+ /**
70
+ * @implements DOM API: `Node`
71
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_following
72
+ */
73
+ this.DOCUMENT_POSITION_FOLLOWING = 0b100;
74
+ /**
75
+ * @implements DOM API: `Node`
76
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_implementation_specific
77
+ */
78
+ this.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
79
+ /**
80
+ * @implements DOM API: `Node`
81
+ * @see https://dom.spec.whatwg.org/#dom-node-document_position_preceding
82
+ */
83
+ this.DOCUMENT_POSITION_PRECEDING = 0b10;
84
+ /**
85
+ * @implements DOM API: `Node`
86
+ * @see https://dom.spec.whatwg.org/#interface-node
87
+ */
88
+ this.DOCUMENT_TYPE_NODE = 10;
89
+ /**
90
+ * @implements DOM API: `Node`
91
+ * @see https://dom.spec.whatwg.org/#interface-node
92
+ */
93
+ this.ELEMENT_NODE = 1;
94
+ /**
95
+ * @deprecated
96
+ * @implements DOM API: `Node`
97
+ * @see https://dom.spec.whatwg.org/#interface-node
98
+ */
99
+ this.ENTITY_NODE = 6;
100
+ /**
101
+ * @deprecated
102
+ * @implements DOM API: `Node`
103
+ * @see https://dom.spec.whatwg.org/#interface-node
104
+ */
105
+ this.ENTITY_REFERENCE_NODE = 5;
106
+ /**
107
+ * @implements `@markuplint/ml-core` API: `MLNode`
108
+ */
109
+ this.MARKUPLINT_PREPROCESSOR_BLOCK = 101;
110
+ /**
111
+ * @deprecated
112
+ * @implements DOM API: `Node`
113
+ * @see https://dom.spec.whatwg.org/#interface-node
114
+ */
115
+ this.NOTATION_NODE = 12;
116
+ /**
117
+ * @implements DOM API: `Node`
118
+ * @see https://dom.spec.whatwg.org/#interface-node
119
+ */
120
+ this.PROCESSING_INSTRUCTION_NODE = 7;
121
+ this.rules = {};
122
+ /**
123
+ * @implements DOM API: `Node`
124
+ * @see https://dom.spec.whatwg.org/#interface-node
125
+ */
126
+ this.TEXT_NODE = 3;
127
+ this._astToken = astNode;
128
+ tslib_1.__classPrivateFieldSet(this, _MLNode_ownerDocument, document, "f");
129
+ node_store_1.nodeStore.setNode(astNode, this);
130
+ }
131
+ /**
132
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
133
+ *
134
+ * @unsupported
135
+ * @implements DOM API: `Node`
136
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-baseuri%E2%91%A0
137
+ */
138
+ get baseURI() {
139
+ throw new unexpected_call_error_1.default('Not supported "baseURI" property');
140
+ }
141
+ /**
142
+ * The list of child nodes that contains `Element`, `Text`, and `Comment`.
143
+ *
144
+ * @readonly
145
+ * @implements DOM API: `Node`
146
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-childnodes%E2%91%A0
147
+ */
148
+ get childNodes() {
149
+ if (tslib_1.__classPrivateFieldGet(this, _MLNode_childNodes, "f") != null) {
150
+ return tslib_1.__classPrivateFieldGet(this, _MLNode_childNodes, "f");
151
+ }
152
+ if (this.is(this.DOCUMENT_NODE)) {
153
+ const childNodes = [];
154
+ for (const node of this.nodeList) {
155
+ if ((0, child_node_1.isChildNode)(node) && (node.parentNode === this || node.parentNode === null)) {
156
+ childNodes.push(node);
157
+ }
158
+ }
159
+ // Cache
160
+ tslib_1.__classPrivateFieldSet(this, _MLNode_childNodes, (0, node_list_1.toNodeList)(childNodes), "f");
161
+ return tslib_1.__classPrivateFieldGet(this, _MLNode_childNodes, "f");
162
+ }
163
+ if (this.is(this.DOCUMENT_FRAGMENT_NODE) ||
164
+ this.is(this.ELEMENT_NODE) ||
165
+ this.is(this.MARKUPLINT_PREPROCESSOR_BLOCK)) {
166
+ // @ts-ignore
167
+ const astChildren = this._astToken.childNodes || [];
168
+ const childNodes = astChildren
169
+ .map(node => node_store_1.nodeStore.getNode(node))
170
+ .filter((node) => (0, child_node_1.isChildNode)(node));
171
+ // Cache
172
+ tslib_1.__classPrivateFieldSet(this, _MLNode_childNodes, (0, node_list_1.toNodeList)(childNodes), "f");
173
+ return tslib_1.__classPrivateFieldGet(this, _MLNode_childNodes, "f");
174
+ }
175
+ // Cache
176
+ tslib_1.__classPrivateFieldSet(this, _MLNode_childNodes, (0, node_list_1.toNodeList)([]), "f");
177
+ return tslib_1.__classPrivateFieldGet(this, _MLNode_childNodes, "f");
178
+ }
179
+ /**
180
+ * The first node that may be `Element`, `Text`, and `CommentNode`.
181
+ *
182
+ * @readonly
183
+ * @implements DOM API: `Node`
184
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-firstchild%E2%91%A0
185
+ */
186
+ get firstChild() {
187
+ return this.childNodes[0] || null;
188
+ }
189
+ /**
190
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
191
+ *
192
+ * @unsupported
193
+ * @implements DOM API: `Node`
194
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-isconnected%E2%91%A0
195
+ */
196
+ get isConnected() {
197
+ throw new unexpected_call_error_1.default('Not supported "isConnected" property');
198
+ }
199
+ /**
200
+ * The last node that may be `Element`, `Text`, and `CommentNode`.
201
+ *
202
+ * @readonly
203
+ * @implements DOM API: `Node`
204
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-lastchild%E2%91%A0
205
+ */
206
+ get lastChild() {
207
+ return this.childNodes[this.childNodes.length - 1] || null;
208
+ }
209
+ /**
210
+ * @implements `@markuplint/ml-core` API: `MLNode`
211
+ */
212
+ get nextNode() {
213
+ if (!this._astToken.nextNode) {
214
+ return null;
215
+ }
216
+ return node_store_1.nodeStore.getNode(this._astToken.nextNode);
217
+ }
218
+ /**
219
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
220
+ *
221
+ * @unsupported
222
+ * @implements DOM API: `Node`
223
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-nextsibling%E2%91%A0
224
+ */
225
+ get nextSibling() {
226
+ throw new unexpected_call_error_1.default('Not supported "nextSibling" property');
227
+ }
228
+ /**
229
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
230
+ *
231
+ * It must not call from the instance of the `MLNode` class.
232
+ *
233
+ * @implements DOM API: `Node`
234
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-nodename%E2%91%A0
235
+ */
236
+ get nodeName() {
237
+ throw new Error('It must not call from the instance of the `MLNode` class');
238
+ }
239
+ /**
240
+ * @implements DOM API: `Node`
241
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-nodetype%E2%91%A0
242
+ */
243
+ get nodeType() {
244
+ return -1;
245
+ }
246
+ /**
247
+ * The nodeValue getter steps are to return the following, switching on the interface this implements:
248
+ *
249
+ * - `Attr`: this’s value.
250
+ * - `CharacterData`: this’s data.
251
+ * - _Otherwise_: Null.
252
+ *
253
+ * @implements DOM API: `Node`
254
+ * @see https://dom.spec.whatwg.org/#dom-node-nodevalue
255
+ */
256
+ get nodeValue() {
257
+ return null;
258
+ }
259
+ /**
260
+ * The `Document` that this node belongs to.
261
+ *
262
+ * @deprecated
263
+ * @implements DOM API: `Node`
264
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-ownerdocument%E2%91%A0
265
+ */
266
+ get ownerDocument() {
267
+ return tslib_1.__classPrivateFieldGet(this, _MLNode_ownerDocument, "f");
268
+ }
269
+ get ownerMLDocument() {
270
+ return tslib_1.__classPrivateFieldGet(this, _MLNode_ownerDocument, "f");
271
+ }
272
+ /**
273
+ * The parent element.
274
+ *
275
+ * @implements DOM API: `Node`
276
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-parentelement%E2%91%A0
277
+ */
278
+ get parentElement() {
279
+ let parent = this.parentNode;
280
+ while (parent) {
281
+ if (parent.is(parent.ELEMENT_NODE)) {
282
+ return parent;
283
+ }
284
+ parent = parent.parentNode;
285
+ }
286
+ return null;
287
+ }
288
+ /**
289
+ * The parent node that may be `Element`, `Document`, `DocumentFragment`, and `null`.
290
+ *
291
+ * ## HTML:
292
+ *
293
+ * ```html
294
+ * <html> // => #document
295
+ * <body></body> // => <html>
296
+ * </html>
297
+ * ```
298
+ *
299
+ * ---
300
+ *
301
+ * ```html
302
+ * <div> // => null
303
+ * <span></span> // => <div>
304
+ * </div>
305
+ * ```
306
+ *
307
+ * ## JSX:
308
+ *
309
+ * ```jsx
310
+ * <> // => null
311
+ * <div> // => #document-fragment
312
+ * {items.map(item => {
313
+ * return (
314
+ * <span /> // => null
315
+ * )
316
+ * })}
317
+ * </div>
318
+ * </>
319
+ * ```
320
+ *
321
+ * ## Pug
322
+ *
323
+ * ```jade
324
+ * //- null
325
+ * div
326
+ * //- <div>
327
+ * if foo
328
+ * //- null
329
+ * span
330
+ * ```
331
+ *
332
+ * @implements DOM API: `Node`
333
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-parentnode%E2%91%A0
334
+ */
335
+ get parentNode() {
336
+ const parentNode = this.syntaxicalParentNode;
337
+ if (!parentNode) {
338
+ return null;
339
+ }
340
+ if (parentNode.is(parentNode.MARKUPLINT_PREPROCESSOR_BLOCK)) {
341
+ if (parentNode.isTransparent) {
342
+ return parentNode.parentNode;
343
+ }
344
+ return null;
345
+ }
346
+ if (parentNode.is(parentNode.ELEMENT_NODE) || parentNode.is(parentNode.DOCUMENT_FRAGMENT_NODE)) {
347
+ return parentNode;
348
+ }
349
+ if (parentNode.is(parentNode.DOCUMENT_NODE) && parentNode.isFragment) {
350
+ return null;
351
+ }
352
+ return parentNode;
353
+ }
354
+ /**
355
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
356
+ *
357
+ * @unsupported
358
+ * @implements DOM API: `Node`
359
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-previoussibling%E2%91%A0
360
+ */
361
+ get previousSibling() {
362
+ throw new unexpected_call_error_1.default('Not supported "previousSibling" property');
363
+ }
364
+ /**
365
+ * @implements `@markuplint/ml-core` API: `MLNode`
366
+ */
367
+ get prevNode() {
368
+ if (!this._astToken.prevNode) {
369
+ return null;
370
+ }
371
+ return node_store_1.nodeStore.getNode(this._astToken.prevNode);
372
+ }
373
+ /**
374
+ * @implements `@markuplint/ml-core` API: `MLNode`
375
+ */
376
+ get prevToken() {
377
+ if (tslib_1.__classPrivateFieldGet(this, _MLNode_prevToken, "f") !== undefined) {
378
+ return tslib_1.__classPrivateFieldGet(this, _MLNode_prevToken, "f");
379
+ }
380
+ let index = -1;
381
+ for (let i = 0; i < this.ownerMLDocument.nodeList.length; i++) {
382
+ const node = this.ownerMLDocument.nodeList[i];
383
+ if (!node) {
384
+ continue;
385
+ }
386
+ if (node.is(this.ELEMENT_NODE) && node.isOmitted) {
387
+ continue;
388
+ }
389
+ if (node.uuid === this.uuid) {
390
+ index = i;
391
+ break;
392
+ }
393
+ }
394
+ if (index === -1) {
395
+ tslib_1.__classPrivateFieldSet(this, _MLNode_prevToken, null, "f");
396
+ return tslib_1.__classPrivateFieldGet(this, _MLNode_prevToken, "f");
397
+ }
398
+ tslib_1.__classPrivateFieldSet(this, _MLNode_prevToken, this.ownerMLDocument.nodeList[index - 1] || null, "f");
399
+ return tslib_1.__classPrivateFieldGet(this, _MLNode_prevToken, "f") || null;
400
+ }
401
+ /**
402
+ * @implements `@markuplint/ml-core` API: `MLNode`
403
+ */
404
+ get rule() {
405
+ if (!this.ownerMLDocument.currentRule) {
406
+ throw new Error('Invalid call: Some rule evaluations may not be running asynchronously.');
407
+ }
408
+ const name = this.ownerMLDocument.currentRule.name;
409
+ const rule = this.rules[name];
410
+ return this.ownerMLDocument.currentRule.optimizeOption(rule);
411
+ }
412
+ /**
413
+ * Returns a syntaxical parent node
414
+ *
415
+ * ## HTML:
416
+ *
417
+ * ```html
418
+ * <html> // => #document
419
+ * <body></body> // => <html>
420
+ * </html>
421
+ * ```
422
+ *
423
+ * ## JSX:
424
+ *
425
+ * ```jsx
426
+ * <> // => #document
427
+ * <div> // => #document-fragment
428
+ * {items.map(item => {
429
+ * return (
430
+ * <span /> // => #ml-block
431
+ * )
432
+ * })}
433
+ * </div>
434
+ * </>
435
+ * ```
436
+ *
437
+ * ## Pug
438
+ *
439
+ * ```jade
440
+ * //- #document
441
+ * div
442
+ * //- <div>
443
+ * if foo
444
+ * //- #ml-block
445
+ * span
446
+ * ```
447
+ *
448
+ * @implements `@markuplint/ml-core` API: `MLNode`
449
+ */
450
+ get syntaxicalParentNode() {
451
+ if (!this._astToken.parentNode) {
452
+ return this.ownerMLDocument;
453
+ }
454
+ return node_store_1.nodeStore.getNode(this._astToken.parentNode);
455
+ }
456
+ /**
457
+ * Return the text content.
458
+ *
459
+ * - If the node is a `Comment`, or `Text`, textContent returns, or sets, the text inside the node, i.e., the Node.nodeValue.
460
+ * - 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.)
461
+ *
462
+ * @implements DOM API: `Node`
463
+ * @see https://dom.spec.whatwg.org/#dom-node-textcontent
464
+ */
465
+ get textContent() {
466
+ return null;
467
+ }
468
+ /**
469
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
470
+ *
471
+ * @unsupported
472
+ * @implements DOM API: `EventTarget`
473
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-addeventlistener%E2%91%A2
474
+ */
475
+ addEventListener(type, callback, options = {}) {
476
+ throw new unexpected_call_error_1.default('Not supported "addEventListener" method');
477
+ }
478
+ /**
479
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
480
+ *
481
+ * @unsupported
482
+ * @implements DOM API: `Node`
483
+ * @see https://dom.spec.whatwg.org/#dom-node-appendchild
484
+ */
485
+ appendChild(node) {
486
+ throw new unexpected_call_error_1.default('Not supported "appendChild" method');
487
+ }
488
+ /**
489
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
490
+ *
491
+ * @unsupported
492
+ * @implements DOM API: `Node`
493
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-clonenode%E2%91%A0
494
+ */
495
+ cloneNode(deep) {
496
+ throw new unexpected_call_error_1.default('Not supported "appendChild" method');
497
+ }
498
+ /**
499
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
500
+ *
501
+ * @unsupported
502
+ * @implements DOM API: `Node`
503
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-comparedocumentposition%E2%91%A0
504
+ */
505
+ compareDocumentPosition(other) {
506
+ throw new unexpected_call_error_1.default('Not supported "compareDocumentPosition" method');
507
+ }
508
+ /**
509
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
510
+ *
511
+ * @unsupported
512
+ * @implements DOM API: `Node`
513
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-contains%E2%91%A0
514
+ */
515
+ contains(other) {
516
+ throw new unexpected_call_error_1.default('Not supported "contains" method');
517
+ }
518
+ /**
519
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
520
+ *
521
+ * @unsupported
522
+ * @implements DOM API: `EventTarget`
523
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-dispatchevent%E2%91%A2
524
+ */
525
+ dispatchEvent(event) {
526
+ throw new unexpected_call_error_1.default('Not supported "dispatchEvent" method');
527
+ }
528
+ /**
529
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
530
+ *
531
+ * @unsupported
532
+ * @implements DOM API: `Node`
533
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-getrootnode%E2%91%A0
534
+ */
535
+ getRootNode(options) {
536
+ if (options) {
537
+ throw new unexpected_call_error_1.default('Not supported options');
538
+ }
539
+ let parent = this.parentNode;
540
+ while (parent) {
541
+ if (!parent.parentNode) {
542
+ return parent;
543
+ }
544
+ parent = parent.parentNode;
545
+ }
546
+ return parent || this;
547
+ }
548
+ /**
549
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
550
+ *
551
+ * @unsupported
552
+ * @implements DOM API: `Node`
553
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-haschildnodes%E2%91%A0
554
+ */
555
+ hasChildNodes() {
556
+ throw new unexpected_call_error_1.default('Not supported "hasChildNodes" method');
557
+ }
558
+ /**
559
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
560
+ *
561
+ * @unsupported
562
+ * @implements DOM API: `Node`
563
+ * @see https://dom.spec.whatwg.org/#dom-node-insertbefore
564
+ */
565
+ insertBefore(node, child) {
566
+ throw new unexpected_call_error_1.default('Not supported "insertBefore" method');
567
+ }
568
+ /**
569
+ * @implements `@markuplint/ml-core` API: `MLNode`
570
+ */
571
+ is(nodeType) {
572
+ return this.nodeType === nodeType;
573
+ }
574
+ /**
575
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
576
+ *
577
+ * @unsupported
578
+ * @implements DOM API: `Node`
579
+ * @see https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
580
+ */
581
+ isDefaultNamespace(namespace) {
582
+ throw new unexpected_call_error_1.default('Not supported "isDefaultNamespace" method');
583
+ }
584
+ /**
585
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
586
+ *
587
+ * @unsupported
588
+ * @implements DOM API: `Node`
589
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-isequalnode%E2%91%A0
590
+ */
591
+ isEqualNode(otherNode) {
592
+ throw new unexpected_call_error_1.default('Not supported "isEqualNode" method');
593
+ }
594
+ /**
595
+ * @implements `@markuplint/ml-core` API: `MLNode`
596
+ */
597
+ isInFragmentDocument() {
598
+ return this.ownerMLDocument.isFragment;
599
+ }
600
+ /**
601
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
602
+ *
603
+ * @unsupported
604
+ * @implements DOM API: `Node`
605
+ * @see https://dom.spec.whatwg.org/#dom-node-issamenode
606
+ */
607
+ isSameNode(otherNode) {
608
+ throw new unexpected_call_error_1.default('Not supported "isSameNode" method');
609
+ }
610
+ /**
611
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
612
+ *
613
+ * @unsupported
614
+ * @implements DOM API: `Node`
615
+ * @see https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri
616
+ */
617
+ lookupNamespaceURI(prefix) {
618
+ throw new unexpected_call_error_1.default('Not supported "lookupNamespaceURI" method');
619
+ }
620
+ /**
621
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
622
+ *
623
+ * @unsupported
624
+ * @implements DOM API: `Node`
625
+ * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
626
+ */
627
+ lookupPrefix(namespace) {
628
+ throw new unexpected_call_error_1.default('Not supported "lookupPrefix" method');
629
+ }
630
+ /**
631
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
632
+ *
633
+ * @unsupported
634
+ * @implements DOM API: `Node`
635
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-normalize%E2%91%A0
636
+ */
637
+ normalize() {
638
+ throw new unexpected_call_error_1.default('Not supported "normalize" method');
639
+ }
640
+ /**
641
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
642
+ *
643
+ * @unsupported
644
+ * @implements DOM API: `Node`
645
+ * @see https://dom.spec.whatwg.org/#dom-node-removechild
646
+ */
647
+ removeChild(child) {
648
+ throw new unexpected_call_error_1.default('Not supported "removeChild" method');
649
+ }
650
+ /**
651
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
652
+ *
653
+ * @unsupported
654
+ * @implements DOM API: `EventTarget`
655
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-removeeventlistener%E2%91%A1
656
+ */
657
+ removeEventListener(type, callback, options = {}) {
658
+ throw new unexpected_call_error_1.default('Not supported "removeEventListener" method');
659
+ }
660
+ /**
661
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
662
+ *
663
+ * @unsupported
664
+ * @implements DOM API: `Node`
665
+ * @see https://dom.spec.whatwg.org/#dom-node-replacechild
666
+ */
667
+ replaceChild(node, child) {
668
+ throw new unexpected_call_error_1.default('Not supported "removeChild" method');
669
+ }
670
+ }
671
+ exports.MLNode = MLNode;
672
+ _MLNode_childNodes = new WeakMap(), _MLNode_ownerDocument = new WeakMap(), _MLNode_prevToken = new WeakMap();