@markuplint/ml-core 2.2.3 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ml-core.d.ts +1 -1
- package/lib/ml-dom/helper/accname.js +1 -0
- package/lib/ml-dom/helper/selector.d.ts +1 -1
- package/lib/ml-dom/manipulations/child-node-methods.d.ts +33 -0
- package/lib/ml-dom/manipulations/child-node-methods.js +73 -0
- package/lib/ml-dom/manipulations/get-children.d.ts +4 -0
- package/lib/ml-dom/manipulations/get-children.js +10 -0
- package/lib/ml-dom/node/attr.d.ts +93 -0
- package/lib/ml-dom/node/attr.js +144 -0
- package/lib/ml-dom/node/block.d.ts +38 -0
- package/lib/ml-dom/node/block.js +53 -0
- package/lib/ml-dom/node/character-data.d.ts +57 -0
- package/lib/ml-dom/node/character-data.js +87 -0
- package/lib/ml-dom/node/child-node.d.ts +9 -0
- package/lib/ml-dom/node/child-node.js +10 -0
- package/lib/ml-dom/node/comment.d.ts +17 -0
- package/lib/ml-dom/node/comment.js +24 -0
- package/lib/ml-dom/node/document-fragment.d.ts +24 -0
- package/lib/ml-dom/node/document-fragment.js +33 -0
- package/lib/ml-dom/node/document-type.d.ts +38 -0
- package/lib/ml-dom/node/document-type.js +52 -0
- package/lib/ml-dom/node/document.d.ts +1554 -0
- package/lib/ml-dom/node/document.js +2117 -0
- package/lib/ml-dom/node/dom-token-list.d.ts +15 -0
- package/lib/ml-dom/node/dom-token-list.js +61 -0
- package/lib/ml-dom/node/element.d.ts +1832 -0
- package/lib/ml-dom/node/element.js +2483 -0
- package/lib/ml-dom/node/named-node-map.d.ts +42 -0
- package/lib/ml-dom/node/named-node-map.js +64 -0
- package/lib/ml-dom/node/node-list.d.ts +6 -0
- package/lib/ml-dom/node/node-list.js +39 -0
- package/lib/ml-dom/node/node-store.d.ts +14 -0
- package/lib/ml-dom/node/node-store.js +32 -0
- package/lib/ml-dom/node/node.d.ts +475 -0
- package/lib/ml-dom/node/node.js +672 -0
- package/lib/ml-dom/node/parent-node.d.ts +66 -0
- package/lib/ml-dom/node/parent-node.js +131 -0
- package/lib/ml-dom/node/rule-mapper.d.ts +17 -0
- package/lib/ml-dom/node/rule-mapper.js +49 -0
- package/lib/ml-dom/node/text.d.ts +51 -0
- package/lib/ml-dom/node/text.js +76 -0
- package/lib/ml-dom/node/types.d.ts +25 -0
- package/lib/ml-dom/node/types.js +2 -0
- package/lib/ml-dom/node/unexpected-call-error.d.ts +2 -0
- package/lib/ml-dom/node/unexpected-call-error.js +5 -0
- package/lib/ml-dom/token/token.d.ts +47 -0
- package/lib/ml-dom/token/token.js +89 -0
- package/lib/ml-dom/tokens/abstract-element.d.ts +1 -2
- package/lib/ml-dom/tokens/abstract-element.js +0 -4
- package/lib/ml-dom/tokens/node.d.ts +1 -0
- package/lib/ml-dom/tokens/node.js +8 -0
- package/lib/selector/is-pure-html-element.d.ts +1 -0
- package/lib/selector/is-pure-html-element.js +7 -0
- package/lib/selector/match-selector.d.ts +14 -0
- package/lib/selector/match-selector.js +230 -0
- package/lib/selector/selector.d.ts +9 -0
- package/lib/selector/selector.js +561 -0
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { MLAttr } from './attr';
|
|
2
|
+
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
3
|
+
export declare class MLNamedNodeMap<T extends RuleConfigValue, O = null> extends Array<MLAttr<T, O>> implements NamedNodeMap {
|
|
4
|
+
getNamedItem(qualifiedName: string): MLAttr<T, O> | null;
|
|
5
|
+
/**
|
|
6
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
7
|
+
*
|
|
8
|
+
* @unsupported
|
|
9
|
+
* @implements DOM API: `NamedNodeMap`
|
|
10
|
+
*/
|
|
11
|
+
getNamedItemNS(namespace: string | null, localName: string): Attr | null;
|
|
12
|
+
item(index: number): MLAttr<T, O> | null;
|
|
13
|
+
/**
|
|
14
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
15
|
+
*
|
|
16
|
+
* @unsupported
|
|
17
|
+
* @implements DOM API: `NamedNodeMap`
|
|
18
|
+
*/
|
|
19
|
+
removeNamedItem(qualifiedName: string): MLAttr<T, O>;
|
|
20
|
+
/**
|
|
21
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
22
|
+
*
|
|
23
|
+
* @unsupported
|
|
24
|
+
* @implements DOM API: `NamedNodeMap`
|
|
25
|
+
*/
|
|
26
|
+
removeNamedItemNS(namespace: string | null, localName: string): MLAttr<T, O>;
|
|
27
|
+
/**
|
|
28
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
29
|
+
*
|
|
30
|
+
* @unsupported
|
|
31
|
+
* @implements DOM API: `NamedNodeMap`
|
|
32
|
+
*/
|
|
33
|
+
setNamedItem(attr: MLAttr<T, O>): MLAttr<T, O> | null;
|
|
34
|
+
/**
|
|
35
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
36
|
+
*
|
|
37
|
+
* @unsupported
|
|
38
|
+
* @implements DOM API: `NamedNodeMap`
|
|
39
|
+
*/
|
|
40
|
+
setNamedItemNS(attr: MLAttr<T, O>): MLAttr<T, O> | null;
|
|
41
|
+
}
|
|
42
|
+
export declare function toNamedNodeMap<T extends RuleConfigValue, O = null>(nodes: ReadonlyArray<MLAttr<T, O>>): MLNamedNodeMap<T, O>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toNamedNodeMap = exports.MLNamedNodeMap = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
|
|
6
|
+
class MLNamedNodeMap extends Array {
|
|
7
|
+
getNamedItem(qualifiedName) {
|
|
8
|
+
return this.find(attr => attr.name === qualifiedName) || null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
12
|
+
*
|
|
13
|
+
* @unsupported
|
|
14
|
+
* @implements DOM API: `NamedNodeMap`
|
|
15
|
+
*/
|
|
16
|
+
getNamedItemNS(namespace, localName) {
|
|
17
|
+
throw new unexpected_call_error_1.default('Not supported "getNamedItemNS" method');
|
|
18
|
+
}
|
|
19
|
+
item(index) {
|
|
20
|
+
return this[index];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
24
|
+
*
|
|
25
|
+
* @unsupported
|
|
26
|
+
* @implements DOM API: `NamedNodeMap`
|
|
27
|
+
*/
|
|
28
|
+
removeNamedItem(qualifiedName) {
|
|
29
|
+
throw new unexpected_call_error_1.default('Not supported "removeNamedItem" method');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
33
|
+
*
|
|
34
|
+
* @unsupported
|
|
35
|
+
* @implements DOM API: `NamedNodeMap`
|
|
36
|
+
*/
|
|
37
|
+
removeNamedItemNS(namespace, localName) {
|
|
38
|
+
throw new unexpected_call_error_1.default('Not supported "removeNamedItemNS" method');
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
42
|
+
*
|
|
43
|
+
* @unsupported
|
|
44
|
+
* @implements DOM API: `NamedNodeMap`
|
|
45
|
+
*/
|
|
46
|
+
setNamedItem(attr) {
|
|
47
|
+
throw new unexpected_call_error_1.default('Not supported "setNamedItem" method');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
51
|
+
*
|
|
52
|
+
* @unsupported
|
|
53
|
+
* @implements DOM API: `NamedNodeMap`
|
|
54
|
+
*/
|
|
55
|
+
setNamedItemNS(attr) {
|
|
56
|
+
throw new unexpected_call_error_1.default('Not supported "setNamedItemNS" method');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.MLNamedNodeMap = MLNamedNodeMap;
|
|
60
|
+
function toNamedNodeMap(nodes) {
|
|
61
|
+
const namedNodeMap = new MLNamedNodeMap(...nodes);
|
|
62
|
+
return namedNodeMap;
|
|
63
|
+
}
|
|
64
|
+
exports.toNamedNodeMap = toNamedNodeMap;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MLChildNode } from './child-node';
|
|
2
|
+
import type { MLElement } from './element';
|
|
3
|
+
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
4
|
+
export declare function toNodeList<T extends RuleConfigValue, O extends Object | null, N extends MLChildNode<T, O>>(nodes: ReadonlyArray<N>): NodeListOf<N>;
|
|
5
|
+
export declare function toHTMLCollection<T extends RuleConfigValue, O = null>(nodes: ReadonlyArray<MLElement<T, O>>): HTMLCollectionOf<MLElement<T, O>>;
|
|
6
|
+
export declare function nodeListToHTMLCollection<T extends RuleConfigValue, O = null>(nodeList: NodeListOf<MLChildNode<T, O>>): HTMLCollectionOf<MLElement<T, O>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodeListToHTMLCollection = exports.toHTMLCollection = exports.toNodeList = void 0;
|
|
4
|
+
class MLNodeList extends Array {
|
|
5
|
+
forEach(callbackfn, thisArg) {
|
|
6
|
+
return super.forEach.bind(this)((v, k) => callbackfn(v, k, thisArg !== null && thisArg !== void 0 ? thisArg : this));
|
|
7
|
+
}
|
|
8
|
+
item(index) {
|
|
9
|
+
return this[index];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function toNodeList(nodes) {
|
|
13
|
+
const nodeList = new MLNodeList(...nodes);
|
|
14
|
+
return nodeList;
|
|
15
|
+
}
|
|
16
|
+
exports.toNodeList = toNodeList;
|
|
17
|
+
class MLHTMLCollection extends Array {
|
|
18
|
+
item(index) {
|
|
19
|
+
return this[index];
|
|
20
|
+
}
|
|
21
|
+
namedItem(name) {
|
|
22
|
+
return this.find(el => el.getAttribute('name') === name) || null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function toHTMLCollection(nodes) {
|
|
26
|
+
const collection = new MLHTMLCollection(...nodes);
|
|
27
|
+
return collection;
|
|
28
|
+
}
|
|
29
|
+
exports.toHTMLCollection = toHTMLCollection;
|
|
30
|
+
function nodeListToHTMLCollection(nodeList) {
|
|
31
|
+
const collection = new MLHTMLCollection();
|
|
32
|
+
nodeList.forEach(node => {
|
|
33
|
+
if (node.is(node.ELEMENT_NODE)) {
|
|
34
|
+
collection.push(node);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return collection;
|
|
38
|
+
}
|
|
39
|
+
exports.nodeListToHTMLCollection = nodeListToHTMLCollection;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MLNode } from './node';
|
|
2
|
+
import type { MappedNode } from './types';
|
|
3
|
+
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
|
|
4
|
+
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
|
+
declare class NodeStore {
|
|
6
|
+
#private;
|
|
7
|
+
getNode<N extends MLASTAbstructNode, T extends RuleConfigValue, O = null>(astNode: N): MappedNode<N, T, O>;
|
|
8
|
+
setNode<A extends MLASTAbstructNode, T extends RuleConfigValue, O = null>(astNode: A, node: MLNode<T, O, A>): void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* `NodeStore` Singleton
|
|
12
|
+
*/
|
|
13
|
+
export declare const nodeStore: NodeStore;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _NodeStore_store;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.nodeStore = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const parser_utils_1 = require("@markuplint/parser-utils");
|
|
7
|
+
class NodeStore {
|
|
8
|
+
constructor() {
|
|
9
|
+
_NodeStore_store.set(this, new Map());
|
|
10
|
+
}
|
|
11
|
+
getNode(astNode) {
|
|
12
|
+
// console.log(`Get: ${astNode.uuid} -> ${astNode.raw.trim()}(${astNode.type})`);
|
|
13
|
+
const node = tslib_1.__classPrivateFieldGet(this, _NodeStore_store, "f").get(astNode.uuid);
|
|
14
|
+
if (!node) {
|
|
15
|
+
throw new parser_utils_1.ParserError('Broke mapping nodes.', {
|
|
16
|
+
line: astNode.startLine,
|
|
17
|
+
col: astNode.startCol,
|
|
18
|
+
raw: astNode.raw,
|
|
19
|
+
nodeName: astNode.nodeName,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return node;
|
|
23
|
+
}
|
|
24
|
+
setNode(astNode, node) {
|
|
25
|
+
tslib_1.__classPrivateFieldGet(this, _NodeStore_store, "f").set(astNode.uuid, node);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
_NodeStore_store = new WeakMap();
|
|
29
|
+
/**
|
|
30
|
+
* `NodeStore` Singleton
|
|
31
|
+
*/
|
|
32
|
+
exports.nodeStore = new NodeStore();
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
import type { RuleInfo } from '../..';
|
|
2
|
+
import type { MLBlock } from './block';
|
|
3
|
+
import type { MLChildNode } from './child-node';
|
|
4
|
+
import type { MLDocument } from './document';
|
|
5
|
+
import type { MLDocumentFragment } from './document-fragment';
|
|
6
|
+
import type { MLElement } from './element';
|
|
7
|
+
import type { MarkuplintPreprocessorBlockType, NodeType, NodeTypeOf } from './types';
|
|
8
|
+
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
|
|
9
|
+
import type { AnyRule, RuleConfigValue } from '@markuplint/ml-config';
|
|
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;
|
|
475
|
+
}
|