@markuplint/ml-core 3.4.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/lib/configs.js +1 -2
  2. package/lib/ml-core.d.ts +5 -5
  3. package/lib/ml-core.js +4 -4
  4. package/lib/ml-dom/helper/accname.js +18 -7
  5. package/lib/ml-dom/helper/create-node.d.ts +6 -5
  6. package/lib/ml-dom/helper/create-node.js +3 -1
  7. package/lib/ml-dom/helper/debug.js +9 -4
  8. package/lib/ml-dom/helper/getIndent.js +18 -12
  9. package/lib/ml-dom/helper/walkers.d.ts +7 -5
  10. package/lib/ml-dom/helper/walkers.js +4 -2
  11. package/lib/ml-dom/manipulations/child-node-methods.d.ts +7 -7
  12. package/lib/ml-dom/manipulations/child-node-methods.js +24 -6
  13. package/lib/ml-dom/manipulations/get-children.d.ts +2 -2
  14. package/lib/ml-dom/manipulations/get-children.js +3 -1
  15. package/lib/ml-dom/node/attr.d.ts +5 -2
  16. package/lib/ml-dom/node/attr.js +8 -4
  17. package/lib/ml-dom/node/block.d.ts +6 -2
  18. package/lib/ml-dom/node/block.js +14 -4
  19. package/lib/ml-dom/node/character-data.d.ts +2 -2
  20. package/lib/ml-dom/node/character-data.js +9 -3
  21. package/lib/ml-dom/node/child-node.d.ts +5 -3
  22. package/lib/ml-dom/node/child-node.js +3 -1
  23. package/lib/ml-dom/node/comment.d.ts +2 -2
  24. package/lib/ml-dom/node/document-fragment.d.ts +2 -2
  25. package/lib/ml-dom/node/document-type.d.ts +2 -2
  26. package/lib/ml-dom/node/document-type.js +14 -4
  27. package/lib/ml-dom/node/document.d.ts +20 -16
  28. package/lib/ml-dom/node/document.js +44 -19
  29. package/lib/ml-dom/node/dom-token-list.d.ts +2 -2
  30. package/lib/ml-dom/node/dom-token-list.js +4 -2
  31. package/lib/ml-dom/node/element.d.ts +15 -7
  32. package/lib/ml-dom/node/element.js +76 -27
  33. package/lib/ml-dom/node/named-node-map.d.ts +3 -3
  34. package/lib/ml-dom/node/named-node-map.js +11 -4
  35. package/lib/ml-dom/node/node-list.d.ts +4 -4
  36. package/lib/ml-dom/node/node-list.js +8 -3
  37. package/lib/ml-dom/node/node-store.d.ts +8 -3
  38. package/lib/ml-dom/node/node-store.js +8 -3
  39. package/lib/ml-dom/node/node.d.ts +2 -2
  40. package/lib/ml-dom/node/node.js +48 -17
  41. package/lib/ml-dom/node/parent-node.d.ts +2 -2
  42. package/lib/ml-dom/node/parent-node.js +15 -6
  43. package/lib/ml-dom/node/rule-mapper.d.ts +3 -3
  44. package/lib/ml-dom/node/rule-mapper.js +8 -3
  45. package/lib/ml-dom/node/text.d.ts +2 -2
  46. package/lib/ml-dom/node/types.d.ts +18 -6
  47. package/lib/ml-rule/create-rule.d.ts +4 -2
  48. package/lib/ml-rule/create-test-rule.d.ts +4 -4
  49. package/lib/ml-rule/ml-rule-context.d.ts +2 -2
  50. package/lib/ml-rule/ml-rule-context.js +3 -1
  51. package/lib/ml-rule/ml-rule.d.ts +14 -6
  52. package/lib/ml-rule/ml-rule.js +33 -28
  53. package/lib/ml-rule/types.d.ts +24 -12
  54. package/lib/plugin/plugin.d.ts +3 -1
  55. package/lib/plugin/types.d.ts +6 -6
  56. package/lib/ruleset/index.d.ts +3 -3
  57. package/lib/ruleset/index.js +4 -4
  58. package/lib/test/index.d.ts +5 -5
  59. package/lib/types.d.ts +9 -8
  60. package/lib/utils/get-location-from-chars.d.ts +1 -1
  61. package/package.json +14 -13
@@ -1,8 +1,8 @@
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 = null>
5
+ export declare class MLDocumentFragment<T extends RuleConfigValue, O extends PlainData = undefined>
6
6
  extends MLParentNode<T, O, MLASTAbstractNode>
7
7
  implements DocumentFragment
8
8
  {
@@ -2,9 +2,9 @@ import type { MLDocument } from './document';
2
2
  import type { MLElement } from './element';
3
3
  import type { DocumentTypeNodeType } from './types';
4
4
  import type { MLASTDoctype } 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 MLDocumentType<T extends RuleConfigValue, O = null>
7
+ export declare class MLDocumentType<T extends RuleConfigValue, O extends PlainData = undefined>
8
8
  extends MLNode<T, O, MLASTDoctype>
9
9
  implements DocumentType
10
10
  {
@@ -4,7 +4,11 @@ exports.MLDocumentType = void 0;
4
4
  const child_node_methods_1 = require("../manipulations/child-node-methods");
5
5
  const node_1 = require("./node");
6
6
  class MLDocumentType extends node_1.MLNode {
7
- constructor(astNode, document) {
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
  this.name = astNode.name;
10
14
  this.publicId = astNode.publicId;
@@ -27,13 +31,17 @@ class MLDocumentType extends node_1.MLNode {
27
31
  /**
28
32
  * @implements DOM API: `CharacterData`
29
33
  */
30
- after(...nodes) {
34
+ after(
35
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
36
+ ...nodes) {
31
37
  (0, child_node_methods_1.after)(this, ...nodes);
32
38
  }
33
39
  /**
34
40
  * @implements DOM API: `CharacterData`
35
41
  */
36
- before(...nodes) {
42
+ before(
43
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
44
+ ...nodes) {
37
45
  (0, child_node_methods_1.before)(this, ...nodes);
38
46
  }
39
47
  /**
@@ -45,7 +53,9 @@ class MLDocumentType extends node_1.MLNode {
45
53
  /**
46
54
  * @implements DOM API: `CharacterData`
47
55
  */
48
- replaceWith(...nodes) {
56
+ replaceWith(
57
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
58
+ ...nodes) {
49
59
  (0, child_node_methods_1.replaceWith)(this, ...nodes);
50
60
  }
51
61
  }
@@ -7,13 +7,17 @@ import type { MLText } from './text';
7
7
  import type { DocumentNodeType } from './types';
8
8
  import type { MLRule } from '../../ml-rule';
9
9
  import type Ruleset from '../../ruleset';
10
+ import type { MLSchema } from '../../types';
10
11
  import type { Walker } from '../helper/walkers';
11
12
  import type { MLToken } from '../token/token';
12
13
  import type { EndTagType, MLASTDocument } from '@markuplint/ml-ast';
13
- import type { Pretender, RuleConfigValue } from '@markuplint/ml-config';
14
- import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
14
+ import type { PlainData, Pretender, RuleConfigValue } from '@markuplint/ml-config';
15
+ import type { MLMLSpec } from '@markuplint/ml-spec';
15
16
  import { MLParentNode } from './parent-node';
16
- export declare class MLDocument<T extends RuleConfigValue, O = null> extends MLParentNode<T, O> implements Document {
17
+ export declare class MLDocument<T extends RuleConfigValue, O extends PlainData = undefined>
18
+ extends MLParentNode<T, O>
19
+ implements Document
20
+ {
17
21
  #private;
18
22
  /**
19
23
  * Detect value as a true if its attribute is booleanish value and omitted.
@@ -31,7 +35,7 @@ export declare class MLDocument<T extends RuleConfigValue, O = null> extends MLP
31
35
  /**
32
36
  *
33
37
  */
34
- currentRule: MLRule<T, O> | null;
38
+ currentRule: Readonly<MLRule<T, O>> | null;
35
39
  /**
36
40
  * This is defined by the parser.
37
41
  *
@@ -53,7 +57,7 @@ export declare class MLDocument<T extends RuleConfigValue, O = null> extends MLP
53
57
  /**
54
58
  *
55
59
  */
56
- readonly specs: Readonly<MLMLSpec>;
60
+ readonly specs: MLMLSpec;
57
61
  /**
58
62
  *
59
63
  * @param ast node list of markuplint AST
@@ -62,12 +66,12 @@ export declare class MLDocument<T extends RuleConfigValue, O = null> extends MLP
62
66
  constructor(
63
67
  ast: MLASTDocument,
64
68
  ruleset: Ruleset,
65
- schemas: readonly [MLMLSpec, ...ExtendedSpec[]],
69
+ schemas: MLSchema,
66
70
  options?: {
67
- filename?: string;
68
- endTag?: 'xml' | 'omittable' | 'never';
69
- booleanish?: boolean;
70
- pretenders?: Pretender[];
71
+ readonly filename?: string;
72
+ readonly endTag?: 'xml' | 'omittable' | 'never';
73
+ readonly booleanish?: boolean;
74
+ readonly pretenders?: readonly Pretender[];
71
75
  },
72
76
  );
73
77
  /**
@@ -488,7 +492,7 @@ export declare class MLDocument<T extends RuleConfigValue, O = null> extends MLP
488
492
  * @unsupported
489
493
  * @implements DOM API: `Document`
490
494
  */
491
- get oncopy(): ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
495
+ get oncopy(): ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
492
496
  /**
493
497
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
494
498
  *
@@ -504,7 +508,7 @@ export declare class MLDocument<T extends RuleConfigValue, O = null> extends MLP
504
508
  * @unsupported
505
509
  * @implements DOM API: `Document`
506
510
  */
507
- get oncut(): ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
511
+ get oncut(): ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
508
512
  /**
509
513
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
510
514
  *
@@ -784,7 +788,7 @@ export declare class MLDocument<T extends RuleConfigValue, O = null> extends MLP
784
788
  * @unsupported
785
789
  * @implements DOM API: `Document`
786
790
  */
787
- get onpaste(): ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
791
+ get onpaste(): ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
788
792
  /**
789
793
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
790
794
  *
@@ -1581,7 +1585,7 @@ export declare class MLDocument<T extends RuleConfigValue, O = null> extends MLP
1581
1585
  /**
1582
1586
  * @implements `@markuplint/ml-core` API: `MLDocument`
1583
1587
  */
1584
- setRule(rule: MLRule<T, O> | null): void;
1588
+ setRule(rule: Readonly<MLRule<T, O>> | null): void;
1585
1589
  /**
1586
1590
  * @implements `@markuplint/ml-core` API: `MLDocument`
1587
1591
  */
@@ -1600,14 +1604,14 @@ export declare class MLDocument<T extends RuleConfigValue, O = null> extends MLP
1600
1604
  * @unsupported
1601
1605
  * @implements DOM API: `Document`
1602
1606
  */
1603
- write(...text: string[]): void;
1607
+ write(...text: readonly string[]): void;
1604
1608
  /**
1605
1609
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
1606
1610
  *
1607
1611
  * @unsupported
1608
1612
  * @implements DOM API: `Document`
1609
1613
  */
1610
- writeln(...text: string[]): void;
1614
+ writeln(...text: readonly string[]): void;
1611
1615
  private _pretending;
1612
1616
  private _ruleMapping;
1613
1617
  }
@@ -23,8 +23,10 @@ class MLDocument extends parent_node_1.MLParentNode {
23
23
  * @param ast node list of markuplint AST
24
24
  * @param ruleset ruleset object
25
25
  */
26
- constructor(ast, ruleset, schemas, options) {
27
- var _a;
26
+ constructor(
27
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
28
+ ast, ruleset, schemas, options) {
29
+ var _a, _b;
28
30
  // @ts-ignore
29
31
  super(ast, null);
30
32
  /**
@@ -38,8 +40,8 @@ class MLDocument extends parent_node_1.MLParentNode {
38
40
  _MLDocument_tokenList.set(this, null);
39
41
  this.isFragment = ast.isFragment;
40
42
  this.specs = (0, ml_spec_1.schemaToSpec)(schemas);
41
- this.booleanish = (options === null || options === void 0 ? void 0 : options.booleanish) || false;
42
- this.endTag = (_a = options === null || options === void 0 ? void 0 : options.endTag) !== null && _a !== void 0 ? _a : 'omittable';
43
+ this.booleanish = (_a = options === null || options === void 0 ? void 0 : options.booleanish) !== null && _a !== void 0 ? _a : false;
44
+ this.endTag = (_b = options === null || options === void 0 ? void 0 : options.endTag) !== null && _b !== void 0 ? _b : 'omittable';
43
45
  tslib_1.__classPrivateFieldSet(this, _MLDocument_filename, options === null || options === void 0 ? void 0 : options.filename, "f");
44
46
  // console.log(ast.nodeList.map((n, i) => `${i}: ${n.uuid} "${n.raw.trim()}"(${n.type})`));
45
47
  this.nodeList = Object.freeze(ast.nodeList
@@ -204,7 +206,9 @@ class MLDocument extends parent_node_1.MLParentNode {
204
206
  */
205
207
  get defaultView() {
206
208
  return {
207
- getComputedStyle(_el) {
209
+ getComputedStyle(
210
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
211
+ _el) {
208
212
  return {
209
213
  getPropertyValue(_propName) {
210
214
  return {};
@@ -1665,7 +1669,9 @@ class MLDocument extends parent_node_1.MLParentNode {
1665
1669
  * @unsupported
1666
1670
  * @implements DOM API: `Document`
1667
1671
  */
1668
- createExpression(expression, resolver) {
1672
+ createExpression(expression,
1673
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1674
+ resolver) {
1669
1675
  throw new unexpected_call_error_1.default('Not supported "createExpression" method');
1670
1676
  }
1671
1677
  /**
@@ -1674,7 +1680,9 @@ class MLDocument extends parent_node_1.MLParentNode {
1674
1680
  * @unsupported
1675
1681
  * @implements DOM API: `Document`
1676
1682
  */
1677
- createNSResolver(nodeResolver) {
1683
+ createNSResolver(
1684
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1685
+ nodeResolver) {
1678
1686
  throw new unexpected_call_error_1.default('Not supported "createNSResolver" method');
1679
1687
  }
1680
1688
  /**
@@ -1683,7 +1691,11 @@ class MLDocument extends parent_node_1.MLParentNode {
1683
1691
  * @unsupported
1684
1692
  * @implements DOM API: `Document`
1685
1693
  */
1686
- createNodeIterator(root, whatToShow, filter) {
1694
+ createNodeIterator(
1695
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1696
+ root, whatToShow,
1697
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1698
+ filter) {
1687
1699
  throw new unexpected_call_error_1.default('Not supported "createNodeIterator" method');
1688
1700
  }
1689
1701
  /**
@@ -1719,7 +1731,11 @@ class MLDocument extends parent_node_1.MLParentNode {
1719
1731
  * @unsupported
1720
1732
  * @implements DOM API: `Document`
1721
1733
  */
1722
- createTreeWalker(root, whatToShow, filter) {
1734
+ createTreeWalker(
1735
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1736
+ root, whatToShow,
1737
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1738
+ filter) {
1723
1739
  throw new unexpected_call_error_1.default('Not supported "createTreeWalker" method');
1724
1740
  }
1725
1741
  /**
@@ -1752,7 +1768,13 @@ class MLDocument extends parent_node_1.MLParentNode {
1752
1768
  * @unsupported
1753
1769
  * @implements DOM API: `Document`
1754
1770
  */
1755
- evaluate(expression, contextNode, resolver, type, result) {
1771
+ evaluate(expression,
1772
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1773
+ contextNode,
1774
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1775
+ resolver, type,
1776
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1777
+ result) {
1756
1778
  throw new unexpected_call_error_1.default('Not supported "evaluate" method');
1757
1779
  }
1758
1780
  /**
@@ -2096,13 +2118,14 @@ class MLDocument extends parent_node_1.MLParentNode {
2096
2118
  const selectorTarget = node.is(node.ELEMENT_NODE) ? node : null;
2097
2119
  // node specs and special rules for node by selector
2098
2120
  ruleset.nodeRules.forEach(nodeRule => {
2121
+ var _a, _b;
2099
2122
  if (!nodeRule.rules) {
2100
2123
  return;
2101
2124
  }
2102
2125
  if (!selectorTarget) {
2103
2126
  return;
2104
2127
  }
2105
- const selector = nodeRule.selector || nodeRule.regexSelector;
2128
+ const selector = (_a = nodeRule.selector) !== null && _a !== void 0 ? _a : nodeRule.regexSelector;
2106
2129
  const matches = (0, selector_1.matchSelector)(selectorTarget, selector);
2107
2130
  if (!matches.matched) {
2108
2131
  return;
@@ -2116,12 +2139,12 @@ class MLDocument extends parent_node_1.MLParentNode {
2116
2139
  if (rule == null) {
2117
2140
  continue;
2118
2141
  }
2119
- const convertedRule = (0, ml_config_1.exchangeValueOnRule)(rule, matches.data || {});
2142
+ const convertedRule = (0, ml_config_1.exchangeValueOnRule)(rule, (_b = matches.data) !== null && _b !== void 0 ? _b : {});
2120
2143
  if (convertedRule === undefined) {
2121
2144
  continue;
2122
2145
  }
2123
2146
  const globalRule = ruleset.rules[ruleName];
2124
- const mergedRule = globalRule ? (0, ml_config_1.mergeRule)(globalRule, convertedRule) : convertedRule;
2147
+ const mergedRule = globalRule != null ? (0, ml_config_1.mergeRule)(globalRule, convertedRule) : convertedRule;
2125
2148
  ruleLog('↑ nodeRule (%s): %O', ruleName, mergedRule);
2126
2149
  ruleMapper.set(node, ruleName, {
2127
2150
  from: 'nodeRules',
@@ -2131,19 +2154,20 @@ class MLDocument extends parent_node_1.MLParentNode {
2131
2154
  }
2132
2155
  });
2133
2156
  // overwrite rule to child node
2134
- if (selectorTarget && ruleset.childNodeRules.length) {
2157
+ if (selectorTarget && ruleset.childNodeRules.length > 0) {
2135
2158
  const descendants = [];
2136
2159
  const children = Array.from(selectorTarget.childNodes);
2137
2160
  (0, walkers_1.syncWalk)(children, childNode => {
2138
2161
  descendants.push(childNode);
2139
2162
  });
2140
- ruleset.childNodeRules.forEach((nodeRule, i) => {
2163
+ ruleset.childNodeRules.forEach(nodeRule => {
2164
+ var _a;
2141
2165
  if (!nodeRule.rules) {
2142
2166
  return;
2143
2167
  }
2144
2168
  const nodeRuleRules = nodeRule.rules;
2145
- const selector = nodeRule.selector || nodeRule.regexSelector;
2146
- if (!selector) {
2169
+ const selector = (_a = nodeRule.selector) !== null && _a !== void 0 ? _a : nodeRule.regexSelector;
2170
+ if (selector == null) {
2147
2171
  return;
2148
2172
  }
2149
2173
  const matches = (0, selector_1.matchSelector)(selectorTarget, selector);
@@ -2155,16 +2179,17 @@ class MLDocument extends parent_node_1.MLParentNode {
2155
2179
  }
2156
2180
  const targetDescendants = nodeRule.inheritance ? descendants : children;
2157
2181
  Object.keys(nodeRuleRules).forEach(ruleName => {
2182
+ var _a;
2158
2183
  const rule = nodeRuleRules[ruleName];
2159
2184
  if (rule == null) {
2160
2185
  return;
2161
2186
  }
2162
- const convertedRule = (0, ml_config_1.exchangeValueOnRule)(rule, matches.data || {});
2187
+ const convertedRule = (0, ml_config_1.exchangeValueOnRule)(rule, (_a = matches.data) !== null && _a !== void 0 ? _a : {});
2163
2188
  if (convertedRule === undefined) {
2164
2189
  return;
2165
2190
  }
2166
2191
  const globalRule = ruleset.rules[ruleName];
2167
- const mergedRule = globalRule ? (0, ml_config_1.mergeRule)(globalRule, convertedRule) : convertedRule;
2192
+ const mergedRule = globalRule != null ? (0, ml_config_1.mergeRule)(globalRule, convertedRule) : convertedRule;
2168
2193
  ruleLog('↑ childNodeRule (%s): %O', ruleName, mergedRule);
2169
2194
  targetDescendants.forEach(descendant => {
2170
2195
  ruleMapper.set(descendant, ruleName, {
@@ -11,7 +11,7 @@ export declare class MLDomTokenList extends Array<string> implements DOMTokenLis
11
11
  #private;
12
12
  constructor(tokens: string, ownerAttrs: MLAttr<any, any>[]);
13
13
  get value(): string;
14
- add(...tokens: string[]): void;
14
+ add(...tokens: readonly string[]): void;
15
15
  /**
16
16
  * @implements `@markuplint/ml-core` API: `MLDomTokenList`
17
17
  */
@@ -23,7 +23,7 @@ export declare class MLDomTokenList extends Array<string> implements DOMTokenLis
23
23
  * @implements `@markuplint/ml-core` API: `MLDomTokenList`
24
24
  */
25
25
  pick(token: string): Scope | null;
26
- remove(...tokens: string[]): void;
26
+ remove(...tokens: readonly string[]): void;
27
27
  replace(token: string, newToken: string): boolean;
28
28
  supports(token: string): boolean;
29
29
  toString(): string;
@@ -6,7 +6,9 @@ const tslib_1 = require("tslib");
6
6
  const parser_utils_1 = require("@markuplint/parser-utils");
7
7
  const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
8
8
  class MLDomTokenList extends Array {
9
- constructor(tokens, ownerAttrs) {
9
+ constructor(tokens,
10
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
11
+ ownerAttrs) {
10
12
  const list = tokens
11
13
  .split(/\s+/)
12
14
  .map(t => t.trim())
@@ -43,7 +45,7 @@ class MLDomTokenList extends Array {
43
45
  let offset = 0;
44
46
  const tokens = Array.from(this);
45
47
  const locs = [];
46
- while (tokens.length) {
48
+ while (tokens.length > 0) {
47
49
  const token = tokens.shift();
48
50
  if (!token) {
49
51
  break;
@@ -3,13 +3,13 @@ import type { MLNamedNodeMap } from './named-node-map';
3
3
  import type { MLText } from './text';
4
4
  import type { ElementNodeType, PretenderContext } from './types';
5
5
  import type { ElementType, MLASTElement, NamespaceURI } from '@markuplint/ml-ast';
6
- import type { Pretender, RuleConfigValue, RuleInfo } from '@markuplint/ml-config';
6
+ import type { PlainData, Pretender, RuleConfigValue, RuleInfo } from '@markuplint/ml-config';
7
7
  import type { ARIAVersion } from '@markuplint/ml-spec';
8
8
  import { MLToken } from '../token/token';
9
9
  import { MLAttr } from './attr';
10
10
  import { MLDomTokenList } from './dom-token-list';
11
11
  import { MLParentNode } from './parent-node';
12
- export declare class MLElement<T extends RuleConfigValue, O = null>
12
+ export declare class MLElement<T extends RuleConfigValue, O extends PlainData = undefined>
13
13
  extends MLParentNode<T, O, MLASTElement>
14
14
  implements Element, HTMLOrSVGElement, HTMLElement
15
15
  {
@@ -742,7 +742,7 @@ export declare class MLElement<T extends RuleConfigValue, O = null>
742
742
  * @unsupported
743
743
  * @implements DOM API: `Element`
744
744
  */
745
- get oncopy(): ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
745
+ get oncopy(): ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
746
746
  /**
747
747
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
748
748
  *
@@ -758,7 +758,7 @@ export declare class MLElement<T extends RuleConfigValue, O = null>
758
758
  * @unsupported
759
759
  * @implements DOM API: `Element`
760
760
  */
761
- get oncut(): ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
761
+ get oncut(): ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
762
762
  /**
763
763
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
764
764
  *
@@ -1038,7 +1038,7 @@ export declare class MLElement<T extends RuleConfigValue, O = null>
1038
1038
  * @unsupported
1039
1039
  * @implements DOM API: `Element`
1040
1040
  */
1041
- get onpaste(): ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
1041
+ get onpaste(): ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
1042
1042
  /**
1043
1043
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
1044
1044
  *
@@ -1554,6 +1554,14 @@ export declare class MLElement<T extends RuleConfigValue, O = null>
1554
1554
  * @implements DOM API: `Element`
1555
1555
  */
1556
1556
  blur(): void;
1557
+ /**
1558
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
1559
+ *
1560
+ * @deprecated
1561
+ * @unsupported
1562
+ * @implements DOM API: `Element`
1563
+ */
1564
+ checkVisibility(options?: CheckVisibilityOptions): boolean;
1557
1565
  /**
1558
1566
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
1559
1567
  *
@@ -1737,7 +1745,7 @@ export declare class MLElement<T extends RuleConfigValue, O = null>
1737
1745
  /**
1738
1746
  * @implements `@markuplint/ml-core` API: `MLElement`
1739
1747
  */
1740
- isDescendantByUUIDList(uuidList: string[]): boolean;
1748
+ isDescendantByUUIDList(uuidList: readonly string[]): boolean;
1741
1749
  /**
1742
1750
  * @implements `@markuplint/ml-core` API: `MLElement`
1743
1751
  */
@@ -1750,7 +1758,7 @@ export declare class MLElement<T extends RuleConfigValue, O = null>
1750
1758
  /**
1751
1759
  * Pretenders Initialization
1752
1760
  */
1753
- pretending(pretenders: Pretender[]): void;
1761
+ pretending(pretenders: readonly Pretender[]): void;
1754
1762
  /**
1755
1763
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
1756
1764
  *