@markuplint/ml-core 3.0.0-canary.5 → 3.0.0-dev.177
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/README.md +1 -1
- package/lib/configs.browser.d.ts +2 -0
- package/lib/configs.browser.js +12 -0
- package/lib/configs.js +1 -2
- package/lib/index.d.ts +11 -1
- package/lib/ml-core.d.ts +23 -12
- package/lib/ml-core.js +4 -4
- package/lib/ml-dom/helper/accname.js +18 -7
- package/lib/ml-dom/helper/create-node.d.ts +6 -2
- package/lib/ml-dom/helper/create-node.js +3 -1
- package/lib/ml-dom/helper/debug.js +9 -4
- package/lib/ml-dom/helper/getIndent.d.ts +7 -7
- package/lib/ml-dom/helper/getIndent.js +18 -12
- package/lib/ml-dom/helper/walkers.d.ts +15 -5
- package/lib/ml-dom/helper/walkers.js +22 -16
- package/lib/ml-dom/manipulations/child-node-methods.d.ts +20 -7
- package/lib/ml-dom/manipulations/child-node-methods.js +24 -6
- package/lib/ml-dom/manipulations/get-children.d.ts +4 -2
- package/lib/ml-dom/manipulations/get-children.js +3 -1
- package/lib/ml-dom/node/attr.d.ts +94 -91
- package/lib/ml-dom/node/attr.js +8 -4
- package/lib/ml-dom/node/block.d.ts +36 -32
- package/lib/ml-dom/node/block.js +14 -4
- package/lib/ml-dom/node/character-data.d.ts +60 -53
- package/lib/ml-dom/node/character-data.js +9 -3
- package/lib/ml-dom/node/child-node.d.ts +10 -3
- package/lib/ml-dom/node/child-node.js +3 -1
- package/lib/ml-dom/node/comment.d.ts +16 -13
- package/lib/ml-dom/node/document-fragment.d.ts +23 -20
- package/lib/ml-dom/node/document-type.d.ts +35 -32
- package/lib/ml-dom/node/document-type.js +14 -4
- package/lib/ml-dom/node/document.d.ts +1607 -1589
- package/lib/ml-dom/node/document.js +56 -19
- package/lib/ml-dom/node/dom-token-list.d.ts +26 -26
- package/lib/ml-dom/node/dom-token-list.js +9 -7
- package/lib/ml-dom/node/element.d.ts +1903 -1889
- package/lib/ml-dom/node/element.js +76 -27
- package/lib/ml-dom/node/named-node-map.d.ts +45 -40
- package/lib/ml-dom/node/named-node-map.js +13 -5
- package/lib/ml-dom/node/node-list.d.ts +10 -4
- package/lib/ml-dom/node/node-list.js +25 -5
- package/lib/ml-dom/node/node-store.d.ts +9 -4
- package/lib/ml-dom/node/node-store.js +19 -1
- package/lib/ml-dom/node/node.d.ts +493 -473
- package/lib/ml-dom/node/node.js +52 -19
- package/lib/ml-dom/node/parent-node.d.ts +67 -58
- package/lib/ml-dom/node/parent-node.js +15 -6
- package/lib/ml-dom/node/rule-mapper.d.ts +7 -7
- package/lib/ml-dom/node/rule-mapper.js +11 -3
- package/lib/ml-dom/node/text.d.ts +50 -47
- package/lib/ml-dom/node/types.d.ts +82 -14
- package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -2
- package/lib/ml-dom/token/token.d.ts +44 -44
- package/lib/ml-rule/create-rule.d.ts +4 -2
- package/lib/ml-rule/create-test-rule.d.ts +6 -4
- package/lib/ml-rule/ml-rule-context.d.ts +58 -50
- package/lib/ml-rule/ml-rule-context.js +4 -2
- package/lib/ml-rule/ml-rule.d.ts +36 -26
- package/lib/ml-rule/ml-rule.js +37 -32
- package/lib/ml-rule/types.d.ts +35 -17
- package/lib/plugin/plugin.d.ts +3 -1
- package/lib/plugin/types.d.ts +7 -7
- package/lib/ruleset/index.d.ts +4 -4
- package/lib/ruleset/index.js +4 -4
- package/lib/test/index.d.ts +20 -8
- package/lib/test/index.js +1 -1
- package/lib/types.d.ts +9 -8
- package/lib/utils/get-location-from-chars.d.ts +9 -4
- package/package.json +21 -15
- package/test/ml-dom/helper/accname.spec.js +85 -0
- package/test/ml-dom/helper/create-node.spec.js +18 -0
- package/test/ml-dom/index.spec.js +680 -0
- package/tsconfig.test.json +0 -3
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,98 +1,101 @@
|
|
|
1
1
|
import type { MLElement } from './element';
|
|
2
2
|
import type { AttributeNodeType } from './types';
|
|
3
3
|
import type { MLASTAttr } from '@markuplint/ml-ast';
|
|
4
|
-
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
4
|
+
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
import { MLToken } from '../token/token';
|
|
6
6
|
import { MLDomTokenList } from './dom-token-list';
|
|
7
7
|
import { MLNode } from './node';
|
|
8
|
-
export declare class MLAttr<T extends RuleConfigValue, O
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
8
|
+
export declare class MLAttr<T extends RuleConfigValue, O extends PlainData = undefined>
|
|
9
|
+
extends MLNode<T, O, MLASTAttr>
|
|
10
|
+
implements Attr
|
|
11
|
+
{
|
|
12
|
+
#private;
|
|
13
|
+
readonly candidate?: string;
|
|
14
|
+
readonly endQuote: MLToken | null;
|
|
15
|
+
readonly equal: MLToken | null;
|
|
16
|
+
readonly isDirective?: true;
|
|
17
|
+
readonly isDuplicatable: boolean;
|
|
18
|
+
readonly isDynamicValue?: true;
|
|
19
|
+
readonly nameNode: MLToken | null;
|
|
20
|
+
/**
|
|
21
|
+
* @implements DOM API: `Attr`
|
|
22
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-node-previoussibling%E2%91%A0
|
|
23
|
+
*/
|
|
24
|
+
readonly ownerElement: MLElement<T, O>;
|
|
25
|
+
readonly spacesAfterEqual: MLToken | null;
|
|
26
|
+
readonly spacesBeforeEqual: MLToken | null;
|
|
27
|
+
readonly spacesBeforeName: MLToken | null;
|
|
28
|
+
readonly startQuote: MLToken | null;
|
|
29
|
+
readonly valueNode: MLToken | null;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the "string" if HTML syntax. Otherwise, returns a type in its syntax.
|
|
32
|
+
*
|
|
33
|
+
* @default "string"
|
|
34
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
35
|
+
*/
|
|
36
|
+
readonly valueType: 'string' | 'number' | 'boolean' | 'code';
|
|
37
|
+
constructor(astToken: MLASTAttr, ownElement: MLElement<T, O>);
|
|
38
|
+
/**
|
|
39
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
40
|
+
*
|
|
41
|
+
* @unsupported
|
|
42
|
+
* @implements DOM API: `Attr`
|
|
43
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-attr-localname
|
|
44
|
+
*/
|
|
45
|
+
get localName(): string;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @implements DOM API: `Attr`
|
|
49
|
+
* @see https://dom.spec.whatwg.org/#dom-attr-name
|
|
50
|
+
*/
|
|
51
|
+
get name(): string;
|
|
52
|
+
/**
|
|
53
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
54
|
+
*
|
|
55
|
+
* @unsupported
|
|
56
|
+
* @implements DOM API: `Attr`
|
|
57
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-attr-namespaceuri
|
|
58
|
+
*/
|
|
59
|
+
get namespaceURI(): string | null;
|
|
60
|
+
/**
|
|
61
|
+
* Returns a string appropriate for the type of node as `Attr`
|
|
62
|
+
*
|
|
63
|
+
* @see https://dom.spec.whatwg.org/#ref-for-attr%E2%91%A4
|
|
64
|
+
*/
|
|
65
|
+
get nodeName(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Returns a number appropriate for the type of `Attr`
|
|
68
|
+
*/
|
|
69
|
+
get nodeType(): AttributeNodeType;
|
|
70
|
+
get nodeValue(): string;
|
|
71
|
+
/**
|
|
72
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
73
|
+
*
|
|
74
|
+
* @unsupported
|
|
75
|
+
* @implements DOM API: `Attr`
|
|
76
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-attr-prefix
|
|
77
|
+
*/
|
|
78
|
+
get prefix(): string | null;
|
|
79
|
+
/**
|
|
80
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
81
|
+
*/
|
|
82
|
+
get rule(): import('@markuplint/ml-config').RuleInfo<T, O>;
|
|
83
|
+
/**
|
|
84
|
+
* @implements DOM API: `Attr`
|
|
85
|
+
* @see https://dom.spec.whatwg.org/#dom-attr-specified
|
|
86
|
+
*/
|
|
87
|
+
get specified(): true;
|
|
88
|
+
/**
|
|
89
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
90
|
+
*/
|
|
91
|
+
get tokenList(): MLDomTokenList | null;
|
|
92
|
+
/**
|
|
93
|
+
* @implements DOM API: `Attr`
|
|
94
|
+
* @see https://dom.spec.whatwg.org/#dom-attr-value
|
|
95
|
+
*/
|
|
96
|
+
get value(): string;
|
|
97
|
+
/**
|
|
98
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
99
|
+
*/
|
|
100
|
+
toNormalizeString(): string;
|
|
98
101
|
}
|
package/lib/ml-dom/node/attr.js
CHANGED
|
@@ -9,8 +9,12 @@ const dom_token_list_1 = require("./dom-token-list");
|
|
|
9
9
|
const node_1 = require("./node");
|
|
10
10
|
const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
|
|
11
11
|
class MLAttr extends node_1.MLNode {
|
|
12
|
-
constructor(
|
|
13
|
-
|
|
12
|
+
constructor(
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
14
|
+
astToken,
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
16
|
+
ownElement) {
|
|
17
|
+
var _a, _b, _c, _d;
|
|
14
18
|
super(astToken, ownElement.ownerMLDocument);
|
|
15
19
|
this.endQuote = null;
|
|
16
20
|
this.equal = null;
|
|
@@ -43,8 +47,8 @@ class MLAttr extends node_1.MLNode {
|
|
|
43
47
|
this.isDynamicValue = this._astToken.isDynamicValue;
|
|
44
48
|
this.isDirective = this._astToken.isDirective;
|
|
45
49
|
this.candidate = this._astToken.candidate;
|
|
46
|
-
tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialName, this._astToken.potentialName
|
|
47
|
-
tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.value.raw
|
|
50
|
+
tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialName, (_c = (_a = this._astToken.potentialName) !== null && _a !== void 0 ? _a : (_b = this.nameNode) === null || _b === void 0 ? void 0 : _b.raw) !== null && _c !== void 0 ? _c : '', "f");
|
|
51
|
+
tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialValue, (_d = this._astToken.value.raw) !== null && _d !== void 0 ? _d : '', "f");
|
|
48
52
|
}
|
|
49
53
|
else {
|
|
50
54
|
this.valueType = this._astToken.valueType;
|
|
@@ -2,37 +2,41 @@ import type { MLDocument } from './document';
|
|
|
2
2
|
import type { MLElement } from './element';
|
|
3
3
|
import type { MarkuplintPreprocessorBlockType } from './types';
|
|
4
4
|
import type { MLASTPreprocessorSpecificBlock } from '@markuplint/ml-ast';
|
|
5
|
-
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
|
+
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import { MLNode } from './node';
|
|
7
|
-
export declare class MLBlock<T extends RuleConfigValue, O =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
7
|
+
export declare class MLBlock<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<
|
|
8
|
+
T,
|
|
9
|
+
O,
|
|
10
|
+
MLASTPreprocessorSpecificBlock
|
|
11
|
+
> {
|
|
12
|
+
readonly isTransparent: boolean;
|
|
13
|
+
constructor(astNode: MLASTPreprocessorSpecificBlock, document: MLDocument<T, O>);
|
|
14
|
+
/**
|
|
15
|
+
* Returns a string appropriate for the type of node as `MLBlock`
|
|
16
|
+
*
|
|
17
|
+
* @implements `@markuplint/ml-core` API: `MLBlock`
|
|
18
|
+
*/
|
|
19
|
+
get nodeName(): '#ml-block';
|
|
20
|
+
/**
|
|
21
|
+
* Returns a number appropriate for the type of `MLBlock`
|
|
22
|
+
*
|
|
23
|
+
* @implements `@markuplint/ml-core` API: `MLBlock`
|
|
24
|
+
*/
|
|
25
|
+
get nodeType(): MarkuplintPreprocessorBlockType;
|
|
26
|
+
/**
|
|
27
|
+
* @implements DOM API: `ChildNode`
|
|
28
|
+
*/
|
|
29
|
+
after(...nodes: (string | MLElement<any, any>)[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* @implements DOM API: `ChildNode`
|
|
32
|
+
*/
|
|
33
|
+
before(...nodes: (string | MLElement<any, any>)[]): void;
|
|
34
|
+
/**
|
|
35
|
+
* @implements DOM API: `ChildNode`
|
|
36
|
+
*/
|
|
37
|
+
remove(): void;
|
|
38
|
+
/**
|
|
39
|
+
* @implements DOM API: `ChildNode`
|
|
40
|
+
*/
|
|
41
|
+
replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
|
|
38
42
|
}
|
package/lib/ml-dom/node/block.js
CHANGED
|
@@ -4,7 +4,11 @@ exports.MLBlock = void 0;
|
|
|
4
4
|
const child_node_methods_1 = require("../manipulations/child-node-methods");
|
|
5
5
|
const node_1 = require("./node");
|
|
6
6
|
class MLBlock extends node_1.MLNode {
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
9
|
+
astNode,
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
11
|
+
document) {
|
|
8
12
|
super(astNode, document);
|
|
9
13
|
// TODO:
|
|
10
14
|
this.isTransparent = true;
|
|
@@ -28,13 +32,17 @@ class MLBlock extends node_1.MLNode {
|
|
|
28
32
|
/**
|
|
29
33
|
* @implements DOM API: `ChildNode`
|
|
30
34
|
*/
|
|
31
|
-
after(
|
|
35
|
+
after(
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
37
|
+
...nodes) {
|
|
32
38
|
(0, child_node_methods_1.after)(this, ...nodes);
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
41
|
* @implements DOM API: `ChildNode`
|
|
36
42
|
*/
|
|
37
|
-
before(
|
|
43
|
+
before(
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
45
|
+
...nodes) {
|
|
38
46
|
(0, child_node_methods_1.before)(this, ...nodes);
|
|
39
47
|
}
|
|
40
48
|
/**
|
|
@@ -46,7 +54,9 @@ class MLBlock extends node_1.MLNode {
|
|
|
46
54
|
/**
|
|
47
55
|
* @implements DOM API: `ChildNode`
|
|
48
56
|
*/
|
|
49
|
-
replaceWith(
|
|
57
|
+
replaceWith(
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
59
|
+
...nodes) {
|
|
50
60
|
(0, child_node_methods_1.replaceWith)(this, ...nodes);
|
|
51
61
|
}
|
|
52
62
|
}
|
|
@@ -1,57 +1,64 @@
|
|
|
1
1
|
import type { MLElement } from './element';
|
|
2
2
|
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
|
|
3
|
-
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
3
|
+
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import { MLNode } from './node';
|
|
5
|
-
export declare abstract class MLCharacterData<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
5
|
+
export declare abstract class MLCharacterData<
|
|
6
|
+
T extends RuleConfigValue,
|
|
7
|
+
O extends PlainData = undefined,
|
|
8
|
+
A extends MLASTAbstractNode = MLASTAbstractNode,
|
|
9
|
+
>
|
|
10
|
+
extends MLNode<T, O, A>
|
|
11
|
+
implements CharacterData
|
|
12
|
+
{
|
|
13
|
+
/**
|
|
14
|
+
* @implements DOM API: `CharacterData`
|
|
15
|
+
* @see https://dom.spec.whatwg.org/#dom-characterdata-data
|
|
16
|
+
*/
|
|
17
|
+
get data(): string;
|
|
18
|
+
/**
|
|
19
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
20
|
+
*
|
|
21
|
+
* @unsupported
|
|
22
|
+
* @implements DOM API: `CharacterData`
|
|
23
|
+
* @see https://dom.spec.whatwg.org/#dom-characterdata-length
|
|
24
|
+
*/
|
|
25
|
+
get length(): number;
|
|
26
|
+
/**
|
|
27
|
+
* The element immediately following the specified one in its parent's children list.
|
|
28
|
+
*
|
|
29
|
+
* @readonly
|
|
30
|
+
* @implements DOM API: `CharacterData`
|
|
31
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-nextelementsibling%E2%91%A1
|
|
32
|
+
*/
|
|
33
|
+
get nextElementSibling(): MLElement<T, O> | null;
|
|
34
|
+
get nodeValue(): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* The element immediately prior the specified one in its parent's children list.
|
|
37
|
+
*
|
|
38
|
+
* @readonly
|
|
39
|
+
* @implements DOM API: `CharacterData`
|
|
40
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-previouselementsibling%E2%91%A1
|
|
41
|
+
*/
|
|
42
|
+
get previousElementSibling(): MLElement<T, O> | null;
|
|
43
|
+
/**
|
|
44
|
+
* @implements DOM API: `CharacterData`
|
|
45
|
+
*/
|
|
46
|
+
after(...nodes: (string | MLElement<any, any>)[]): void;
|
|
47
|
+
appendData(data: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* @implements DOM API: `CharacterData`
|
|
50
|
+
*/
|
|
51
|
+
before(...nodes: (string | MLElement<any, any>)[]): void;
|
|
52
|
+
deleteData(offset: number, count: number): void;
|
|
53
|
+
insertData(offset: number, data: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* @implements DOM API: `CharacterData`
|
|
56
|
+
*/
|
|
57
|
+
remove(): void;
|
|
58
|
+
replaceData(offset: number, count: number, data: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* @implements DOM API: `CharacterData`
|
|
61
|
+
*/
|
|
62
|
+
replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
|
|
63
|
+
substringData(offset: number, count: number): string;
|
|
57
64
|
}
|
|
@@ -50,7 +50,9 @@ class MLCharacterData extends node_1.MLNode {
|
|
|
50
50
|
/**
|
|
51
51
|
* @implements DOM API: `CharacterData`
|
|
52
52
|
*/
|
|
53
|
-
after(
|
|
53
|
+
after(
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
55
|
+
...nodes) {
|
|
54
56
|
(0, child_node_methods_1.after)(this, ...nodes);
|
|
55
57
|
}
|
|
56
58
|
// TODO
|
|
@@ -58,7 +60,9 @@ class MLCharacterData extends node_1.MLNode {
|
|
|
58
60
|
/**
|
|
59
61
|
* @implements DOM API: `CharacterData`
|
|
60
62
|
*/
|
|
61
|
-
before(
|
|
63
|
+
before(
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
65
|
+
...nodes) {
|
|
62
66
|
(0, child_node_methods_1.before)(this, ...nodes);
|
|
63
67
|
}
|
|
64
68
|
// TODO
|
|
@@ -76,7 +80,9 @@ class MLCharacterData extends node_1.MLNode {
|
|
|
76
80
|
/**
|
|
77
81
|
* @implements DOM API: `CharacterData`
|
|
78
82
|
*/
|
|
79
|
-
replaceWith(
|
|
83
|
+
replaceWith(
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
85
|
+
...nodes) {
|
|
80
86
|
(0, child_node_methods_1.replaceWith)(this, ...nodes);
|
|
81
87
|
}
|
|
82
88
|
// TODO
|
|
@@ -4,6 +4,13 @@ import type { MLDocumentType } from './document-type';
|
|
|
4
4
|
import type { MLElement } from './element';
|
|
5
5
|
import type { MLNode } from './node';
|
|
6
6
|
import type { MLText } from './text';
|
|
7
|
-
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
8
|
-
export type MLChildNode<T extends RuleConfigValue, O
|
|
9
|
-
|
|
7
|
+
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
8
|
+
export type MLChildNode<T extends RuleConfigValue, O extends PlainData = undefined> =
|
|
9
|
+
| MLDocumentType<T, O>
|
|
10
|
+
| MLCharacterData<T, O>
|
|
11
|
+
| MLText<T, O>
|
|
12
|
+
| MLElement<T, O>
|
|
13
|
+
| MLBlock<T, O>;
|
|
14
|
+
export declare function isChildNode<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
15
|
+
node: MLNode<T, O>,
|
|
16
|
+
): node is MLChildNode<T, O>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isChildNode = void 0;
|
|
4
|
-
function isChildNode(
|
|
4
|
+
function isChildNode(
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
6
|
+
node) {
|
|
5
7
|
return (node.is(node.DOCUMENT_TYPE_NODE) ||
|
|
6
8
|
node.is(node.TEXT_NODE) ||
|
|
7
9
|
node.is(node.ELEMENT_NODE) ||
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { CommentNodeType } from './types';
|
|
2
2
|
import type { MLASTComment } from '@markuplint/ml-ast';
|
|
3
|
-
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
3
|
+
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import { MLCharacterData } from './character-data';
|
|
5
|
-
export declare class MLComment<T extends RuleConfigValue, O
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
export declare class MLComment<T extends RuleConfigValue, O extends PlainData = undefined>
|
|
6
|
+
extends MLCharacterData<T, O, MLASTComment>
|
|
7
|
+
implements Comment
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Returns a string appropriate for the type of node as `Attr`
|
|
11
|
+
*
|
|
12
|
+
* @see https://dom.spec.whatwg.org/#ref-for-exclusive-text-node%E2%91%A0
|
|
13
|
+
*/
|
|
14
|
+
get nodeName(): '#comment';
|
|
15
|
+
/**
|
|
16
|
+
* Returns a number appropriate for the type of `Comment`
|
|
17
|
+
*/
|
|
18
|
+
get nodeType(): CommentNodeType;
|
|
19
|
+
get textContent(): string | null;
|
|
17
20
|
}
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import type { DocumentFragmentNodeType } from './types';
|
|
2
2
|
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
|
|
3
|
-
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
3
|
+
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import { MLParentNode } from './parent-node';
|
|
5
|
-
export declare class MLDocumentFragment<T extends RuleConfigValue, O
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
export declare class MLDocumentFragment<T extends RuleConfigValue, O extends PlainData = undefined>
|
|
6
|
+
extends MLParentNode<T, O, MLASTAbstractNode>
|
|
7
|
+
implements DocumentFragment
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Returns a string appropriate for the type of node as `DocumentFragment`
|
|
11
|
+
*
|
|
12
|
+
* @see https://dom.spec.whatwg.org/#ref-for-documentfragment%E2%91%A0%E2%91%A6
|
|
13
|
+
*/
|
|
14
|
+
get nodeName(): '#document-fragment';
|
|
15
|
+
/**
|
|
16
|
+
* Returns a number appropriate for the type of `DocumentFragment`
|
|
17
|
+
*/
|
|
18
|
+
get nodeType(): DocumentFragmentNodeType;
|
|
19
|
+
/**
|
|
20
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
21
|
+
*
|
|
22
|
+
* @deprecated
|
|
23
|
+
* @unsupported
|
|
24
|
+
* @implements DOM API: `DocumentFragment`
|
|
25
|
+
*/
|
|
26
|
+
getElementById(elementId: string): HTMLElement | null;
|
|
24
27
|
}
|