@markuplint/ml-core 4.13.2 → 4.13.3
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/ARCHITECTURE.ja.md +467 -0
- package/ARCHITECTURE.md +467 -0
- package/CHANGELOG.md +3 -3
- package/README.md +5 -0
- package/SKILL.md +61 -0
- package/docs/linting-pipeline.ja.md +303 -0
- package/docs/linting-pipeline.md +303 -0
- package/docs/maintenance.ja.md +210 -0
- package/docs/maintenance.md +210 -0
- package/docs/ml-dom/attr.ja.md +95 -0
- package/docs/ml-dom/attr.md +95 -0
- package/docs/ml-dom/block.ja.md +272 -0
- package/docs/ml-dom/block.md +272 -0
- package/docs/ml-dom/document.ja.md +141 -0
- package/docs/ml-dom/document.md +141 -0
- package/docs/ml-dom/element.ja.md +176 -0
- package/docs/ml-dom/element.md +176 -0
- package/docs/ml-dom/helpers.ja.md +203 -0
- package/docs/ml-dom/helpers.md +203 -0
- package/docs/ml-dom/node.ja.md +200 -0
- package/docs/ml-dom/node.md +200 -0
- package/docs/ml-dom/others.ja.md +119 -0
- package/docs/ml-dom/others.md +119 -0
- package/docs/ml-dom/overview.ja.md +102 -0
- package/docs/ml-dom/overview.md +102 -0
- package/docs/ml-dom/pretender.ja.md +269 -0
- package/docs/ml-dom/pretender.md +269 -0
- package/docs/ml-dom/rule-mapping.ja.md +371 -0
- package/docs/ml-dom/rule-mapping.md +371 -0
- package/docs/ml-dom.ja.md +18 -0
- package/docs/ml-dom.md +18 -0
- package/docs/rule-system.ja.md +270 -0
- package/docs/rule-system.md +270 -0
- package/lib/convert-ruleset.d.ts +7 -0
- package/lib/convert-ruleset.js +7 -0
- package/lib/debug.d.ts +4 -0
- package/lib/debug.js +4 -0
- package/lib/ml-core.d.ts +36 -0
- package/lib/ml-core.js +29 -0
- package/lib/ml-dom/helper/get-indent.d.ts +4 -1
- package/lib/ml-dom/helper/get-indent.js +4 -1
- package/lib/ml-dom/node/attr.d.ts +65 -4
- package/lib/ml-dom/node/attr.js +53 -4
- package/lib/ml-dom/node/block.d.ts +21 -0
- package/lib/ml-dom/node/block.js +14 -0
- package/lib/ml-dom/node/child-node.d.ts +9 -0
- package/lib/ml-dom/node/child-node.js +9 -0
- package/lib/ml-dom/node/comment.d.ts +7 -0
- package/lib/ml-dom/node/comment.js +7 -0
- package/lib/ml-dom/node/document-fragment.d.ts +8 -0
- package/lib/ml-dom/node/document-fragment.js +8 -0
- package/lib/ml-dom/node/document-type.d.ts +22 -0
- package/lib/ml-dom/node/document-type.js +13 -0
- package/lib/ml-dom/node/document.d.ts +74 -4
- package/lib/ml-dom/node/document.js +57 -2
- package/lib/ml-dom/node/element.d.ts +136 -2
- package/lib/ml-dom/node/element.js +115 -2
- package/lib/ml-dom/node/node.d.ts +16 -0
- package/lib/ml-dom/node/node.js +16 -0
- package/lib/ml-dom/node/text.d.ts +12 -0
- package/lib/ml-dom/node/text.js +12 -0
- package/lib/ml-dom/node/types.d.ts +68 -0
- package/lib/ml-dom/token/token.d.ts +42 -0
- package/lib/ml-dom/token/token.js +36 -0
- package/lib/ml-rule/create-rule.d.ts +9 -0
- package/lib/ml-rule/create-rule.js +9 -0
- package/lib/ml-rule/ml-rule.d.ts +33 -0
- package/lib/ml-rule/ml-rule.js +30 -0
- package/lib/ml-rule/types.d.ts +41 -0
- package/lib/plugin/plugin.d.ts +8 -0
- package/lib/plugin/plugin.js +8 -0
- package/lib/plugin/types.d.ts +21 -0
- package/lib/ruleset/index.d.ts +10 -0
- package/lib/ruleset/index.js +7 -0
- package/lib/test/index.d.ts +42 -1
- package/lib/test/index.js +35 -1
- package/lib/types.d.ts +8 -0
- package/lib/violation-collector.d.ts +33 -0
- package/lib/violation-collector.js +33 -0
- package/package.json +12 -12
|
@@ -12,8 +12,20 @@ import { MLAttr } from './attr.js';
|
|
|
12
12
|
import { MLDomTokenList } from './dom-token-list.js';
|
|
13
13
|
import { MLElementCloseTag } from './element-close-tag.js';
|
|
14
14
|
import { MLParentNode } from './parent-node.js';
|
|
15
|
+
/**
|
|
16
|
+
* Represents a DOM Element node wrapper in the markuplint DOM tree.
|
|
17
|
+
* Provides access to element attributes, tag names, namespace, ARIA properties,
|
|
18
|
+
* accessibility information, pretender context, and CSS selector matching.
|
|
19
|
+
* This is the primary class used for linting HTML elements.
|
|
20
|
+
*
|
|
21
|
+
* @template T - The rule configuration value type
|
|
22
|
+
* @template O - The rule options type
|
|
23
|
+
*/
|
|
15
24
|
export declare class MLElement<T extends RuleConfigValue, O extends PlainData = undefined> extends MLParentNode<T, O, MLASTElement> implements Element, HTMLOrSVGElement, HTMLElement {
|
|
16
25
|
#private;
|
|
26
|
+
/**
|
|
27
|
+
* The closing tag for this element, or null if the element is self-closing or void.
|
|
28
|
+
*/
|
|
17
29
|
readonly closeTag: MLElementCloseTag<T, O> | null;
|
|
18
30
|
/**
|
|
19
31
|
* Element type
|
|
@@ -23,17 +35,45 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
23
35
|
* - `authored`: Authored element (JSX Element etc.) through the view framework or the template engine.
|
|
24
36
|
*/
|
|
25
37
|
readonly elementType: ElementType;
|
|
38
|
+
/**
|
|
39
|
+
* Whether this element belongs to a non-HTML namespace (e.g., SVG or MathML).
|
|
40
|
+
*/
|
|
26
41
|
readonly isForeignElement: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether this element was implicitly created (e.g., an omitted `<body>` tag in HTML).
|
|
44
|
+
*/
|
|
27
45
|
readonly isOmitted: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The namespace URI of this element (e.g., `http://www.w3.org/1999/xhtml` for HTML elements).
|
|
48
|
+
*/
|
|
28
49
|
readonly namespaceURI: NamespaceURI;
|
|
29
50
|
readonly ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
30
51
|
readonly ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
31
52
|
readonly ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
32
53
|
readonly ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The pretender context if this element is participating in pretender behavior,
|
|
56
|
+
* or null if it is not a pretender or pretended element.
|
|
57
|
+
*/
|
|
33
58
|
pretenderContext: PretenderContext<MLElement<T, O>, T, O> | null;
|
|
59
|
+
/**
|
|
60
|
+
* The self-closing solidus token (`/`), or null if the element is not self-closing.
|
|
61
|
+
*/
|
|
34
62
|
readonly selfClosingSolidus: MLToken | null;
|
|
63
|
+
/**
|
|
64
|
+
* The tag close character string (e.g., `>` or `/>` or `%>`).
|
|
65
|
+
*/
|
|
35
66
|
readonly tagCloseChar: string;
|
|
67
|
+
/**
|
|
68
|
+
* The tag open character string (e.g., `<` or `<%`).
|
|
69
|
+
*/
|
|
36
70
|
readonly tagOpenChar: string;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new MLElement instance from an AST element node.
|
|
73
|
+
*
|
|
74
|
+
* @param astNode - The AST element node to wrap
|
|
75
|
+
* @param document - The owning document
|
|
76
|
+
*/
|
|
37
77
|
constructor(astNode: MLASTElement, document: MLDocument<T, O>);
|
|
38
78
|
/**
|
|
39
79
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -467,6 +507,12 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
467
507
|
* @see https://dom.spec.whatwg.org/#dom-slotable-assignedslot
|
|
468
508
|
*/
|
|
469
509
|
get assignedSlot(): HTMLSlotElement | null;
|
|
510
|
+
/**
|
|
511
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
512
|
+
*
|
|
513
|
+
* @unsupported
|
|
514
|
+
* @implements DOM API: `Element`
|
|
515
|
+
*/
|
|
470
516
|
get attributeStyleMap(): StylePropertyMap;
|
|
471
517
|
/**
|
|
472
518
|
* @implements DOM API: `Element`
|
|
@@ -588,9 +634,15 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
588
634
|
*/
|
|
589
635
|
get enterKeyHint(): string;
|
|
590
636
|
/**
|
|
637
|
+
* Returns the fixed (potentially corrected) node name, which may differ from the
|
|
638
|
+
* original node name after lint fixes such as case normalization.
|
|
639
|
+
*
|
|
591
640
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
592
641
|
*/
|
|
593
642
|
get fixedNodeName(): string;
|
|
643
|
+
/**
|
|
644
|
+
* Whether this element has any spread attributes (e.g., `{...props}` in JSX).
|
|
645
|
+
*/
|
|
594
646
|
get hasSpreadAttr(): boolean;
|
|
595
647
|
/**
|
|
596
648
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -1560,6 +1612,9 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1560
1612
|
*/
|
|
1561
1613
|
get previousElementSibling(): MLElement<T, O> | null;
|
|
1562
1614
|
/**
|
|
1615
|
+
* Returns the original raw element name exactly as it appears in the AST,
|
|
1616
|
+
* without any case normalization or pretender resolution.
|
|
1617
|
+
*
|
|
1563
1618
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1564
1619
|
*/
|
|
1565
1620
|
get rawName(): string;
|
|
@@ -1572,6 +1627,9 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1572
1627
|
*/
|
|
1573
1628
|
get role(): string;
|
|
1574
1629
|
/**
|
|
1630
|
+
* Returns the rule configuration for this element, respecting the pretender context.
|
|
1631
|
+
* If the element is a pretended origin, returns the rule from the pretending element.
|
|
1632
|
+
*
|
|
1575
1633
|
* @implements `@markuplint/ml-core` API: `MLNode`
|
|
1576
1634
|
*/
|
|
1577
1635
|
get rule(): RuleInfo<T, O>;
|
|
@@ -1762,6 +1820,12 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1762
1820
|
* @implements DOM API: `Element`
|
|
1763
1821
|
*/
|
|
1764
1822
|
computedStyleMap(): StylePropertyMapReadOnly;
|
|
1823
|
+
/**
|
|
1824
|
+
* Overrides the fixed node name for this element, used when the element's
|
|
1825
|
+
* tag name needs to be corrected during linting (e.g., case normalization).
|
|
1826
|
+
*
|
|
1827
|
+
* @param name - The new node name to set
|
|
1828
|
+
*/
|
|
1765
1829
|
fixNodeName(name: string): void;
|
|
1766
1830
|
/**
|
|
1767
1831
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -1772,7 +1836,12 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1772
1836
|
*/
|
|
1773
1837
|
focus(options?: FocusOptions): void;
|
|
1774
1838
|
/**
|
|
1839
|
+
* Computes the accessible name of this element according to the
|
|
1840
|
+
* Accessible Name and Description Computation algorithm.
|
|
1841
|
+
*
|
|
1775
1842
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1843
|
+
* @param version - The ARIA specification version to use for computation
|
|
1844
|
+
* @returns The computed accessible name string
|
|
1776
1845
|
*/
|
|
1777
1846
|
getAccessibleName(version: ARIAVersion): string;
|
|
1778
1847
|
/**
|
|
@@ -1815,15 +1884,29 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1815
1884
|
*/
|
|
1816
1885
|
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
1817
1886
|
/**
|
|
1887
|
+
* Gets the attribute value from the original (non-pretended) attributes list,
|
|
1888
|
+
* bypassing any pretender context that might be active.
|
|
1889
|
+
*
|
|
1818
1890
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1891
|
+
* @param attrName - The attribute name to look up (case-insensitive)
|
|
1892
|
+
* @returns The attribute value, or null if the attribute is not found
|
|
1819
1893
|
*/
|
|
1820
1894
|
getAttributePretended(attrName: string): string | null;
|
|
1821
1895
|
/**
|
|
1896
|
+
* Returns all attribute tokens matching the given name, including duplicates.
|
|
1897
|
+
* Unlike `getAttribute`, this returns the full `MLAttr` token objects.
|
|
1898
|
+
*
|
|
1822
1899
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1900
|
+
* @param attrName - The attribute name to look up (case-insensitive)
|
|
1901
|
+
* @returns An array of matching attribute tokens
|
|
1823
1902
|
*/
|
|
1824
1903
|
getAttributeToken(attrName: string): MLAttr<T, O>[];
|
|
1825
1904
|
/**
|
|
1905
|
+
* Returns all attribute tokens for this element, respecting the pretender context.
|
|
1906
|
+
* If the element is pretending to be another, returns the pretender's attributes.
|
|
1907
|
+
*
|
|
1826
1908
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1909
|
+
* @returns A frozen array of all attribute tokens
|
|
1827
1910
|
*/
|
|
1828
1911
|
getAttributeTokens(): readonly MLAttr<T, O>[];
|
|
1829
1912
|
/**
|
|
@@ -1834,6 +1917,13 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1834
1917
|
* @see https://www.w3.org/TR/cssom-view-1/#ref-for-dom-element-getboundingclientrect-1
|
|
1835
1918
|
*/
|
|
1836
1919
|
getBoundingClientRect(): DOMRect;
|
|
1920
|
+
/**
|
|
1921
|
+
* Returns child elements and non-whitespace text nodes, skipping omitted elements
|
|
1922
|
+
* by flattening their children into the result. Results are cached for performance.
|
|
1923
|
+
*
|
|
1924
|
+
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1925
|
+
* @returns An array of child elements and non-whitespace text nodes
|
|
1926
|
+
*/
|
|
1837
1927
|
getChildElementsAndTextNodeWithoutWhitespaces(): (MLElement<T, O> | MLText<T, O>)[];
|
|
1838
1928
|
/**
|
|
1839
1929
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -1870,7 +1960,10 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1870
1960
|
*/
|
|
1871
1961
|
getHTML(options?: any): string;
|
|
1872
1962
|
/**
|
|
1963
|
+
* Returns the source location of the element's tag name (excluding the opening `<` character).
|
|
1964
|
+
*
|
|
1873
1965
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1966
|
+
* @returns An object with `offset`, `line`, and `col` properties indicating where the name starts
|
|
1874
1967
|
*/
|
|
1875
1968
|
getNameLocation(): {
|
|
1876
1969
|
offset: number;
|
|
@@ -1896,13 +1989,21 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1896
1989
|
*/
|
|
1897
1990
|
hasAttributes(): boolean;
|
|
1898
1991
|
/**
|
|
1992
|
+
* Checks whether this element has any mutable attributes, such as spread
|
|
1993
|
+
* attributes or attributes with dynamic values from template expressions.
|
|
1994
|
+
*
|
|
1899
1995
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
1996
|
+
* @returns True if any attribute is dynamic or lacks a name node (spread)
|
|
1900
1997
|
*/
|
|
1901
1998
|
hasMutableAttributes(): boolean;
|
|
1902
1999
|
/**
|
|
1903
|
-
*
|
|
2000
|
+
* Checks whether this element has children that are potentially mutable,
|
|
2001
|
+
* such as preprocessor-specific blocks, slot elements, or (optionally) elements
|
|
2002
|
+
* with dynamic attributes.
|
|
1904
2003
|
*
|
|
1905
2004
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2005
|
+
* @param attr - When true, also considers children with mutable attributes as mutable
|
|
2006
|
+
* @returns True if this element has potentially mutable children
|
|
1906
2007
|
*/
|
|
1907
2008
|
hasMutableChildren(attr?: boolean): boolean;
|
|
1908
2009
|
/**
|
|
@@ -1946,11 +2047,20 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1946
2047
|
*/
|
|
1947
2048
|
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
1948
2049
|
/**
|
|
2050
|
+
* Checks whether this element is a descendant of any element whose UUID
|
|
2051
|
+
* is in the given list, by walking up the parent element chain.
|
|
2052
|
+
*
|
|
1949
2053
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2054
|
+
* @param uuidList - A list of element UUIDs to check against
|
|
2055
|
+
* @returns True if any ancestor element's UUID is in the list
|
|
1950
2056
|
*/
|
|
1951
2057
|
isDescendantByUUIDList(uuidList: readonly string[]): boolean;
|
|
1952
2058
|
/**
|
|
2059
|
+
* Checks whether this element has no meaningful child content
|
|
2060
|
+
* (only whitespace-only text nodes or no children at all).
|
|
2061
|
+
*
|
|
1953
2062
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2063
|
+
* @returns True if the element has no non-whitespace child content
|
|
1954
2064
|
*/
|
|
1955
2065
|
isEmpty(): boolean;
|
|
1956
2066
|
/**
|
|
@@ -1958,9 +2068,22 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
1958
2068
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-element-matches%E2%91%A0
|
|
1959
2069
|
*/
|
|
1960
2070
|
matches(selector: string, scope?: MLParentNode<T, O>): boolean;
|
|
2071
|
+
/**
|
|
2072
|
+
* Matches this element against a CSS selector or regex selector pattern,
|
|
2073
|
+
* returning detailed match results. When the element is a pretender,
|
|
2074
|
+
* it attempts to match both as the pretender and as the original element.
|
|
2075
|
+
*
|
|
2076
|
+
* @param selector - The CSS selector string or regex selector to match against
|
|
2077
|
+
* @param scope - An optional scope node for scoped selector matching
|
|
2078
|
+
* @returns The detailed match result including captured groups from regex selectors
|
|
2079
|
+
*/
|
|
1961
2080
|
matchMLSelector(selector: string | RegexSelector | undefined, scope?: MLParentNode<T, O>): SelectorMatches;
|
|
1962
2081
|
/**
|
|
1963
|
-
*
|
|
2082
|
+
* Initializes the pretender context for this element based on the given pretender
|
|
2083
|
+
* configurations. If a matching pretender is found or the element has an `as` attribute,
|
|
2084
|
+
* sets up the pretender/pretended relationship between elements.
|
|
2085
|
+
*
|
|
2086
|
+
* @param pretenders - Optional array of pretender configurations to match against
|
|
1964
2087
|
*/
|
|
1965
2088
|
pretending(pretenders?: readonly Pretender[]): void;
|
|
1966
2089
|
/**
|
|
@@ -2108,11 +2231,22 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
|
|
|
2108
2231
|
*/
|
|
2109
2232
|
showPopover(): void;
|
|
2110
2233
|
/**
|
|
2234
|
+
* Returns a normalized string representation of this element including its tag name,
|
|
2235
|
+
* attributes, and child content. Whitespace-only text nodes are excluded.
|
|
2236
|
+
* The result is cached for repeated calls.
|
|
2237
|
+
*
|
|
2111
2238
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2239
|
+
* @returns The normalized HTML string of this element
|
|
2112
2240
|
*/
|
|
2113
2241
|
toNormalizeString(): string;
|
|
2114
2242
|
/**
|
|
2243
|
+
* Returns a string representation of this element. When `fixed` is true,
|
|
2244
|
+
* returns the element with any lint fixes applied to the tag name,
|
|
2245
|
+
* attributes, and embedded comment nodes.
|
|
2246
|
+
*
|
|
2115
2247
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2248
|
+
* @param fixed - When true, returns the fixed content; otherwise returns the original raw content
|
|
2249
|
+
* @returns The string content of this element
|
|
2116
2250
|
*/
|
|
2117
2251
|
toString(fixed?: boolean): string;
|
|
2118
2252
|
/**
|
|
@@ -24,7 +24,22 @@ import { toHTMLCollection } from './node-list.js';
|
|
|
24
24
|
import { MLParentNode } from './parent-node.js';
|
|
25
25
|
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
26
26
|
const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
27
|
+
/**
|
|
28
|
+
* Represents a DOM Element node wrapper in the markuplint DOM tree.
|
|
29
|
+
* Provides access to element attributes, tag names, namespace, ARIA properties,
|
|
30
|
+
* accessibility information, pretender context, and CSS selector matching.
|
|
31
|
+
* This is the primary class used for linting HTML elements.
|
|
32
|
+
*
|
|
33
|
+
* @template T - The rule configuration value type
|
|
34
|
+
* @template O - The rule options type
|
|
35
|
+
*/
|
|
27
36
|
export class MLElement extends MLParentNode {
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new MLElement instance from an AST element node.
|
|
39
|
+
*
|
|
40
|
+
* @param astNode - The AST element node to wrap
|
|
41
|
+
* @param document - The owning document
|
|
42
|
+
*/
|
|
28
43
|
constructor(astNode,
|
|
29
44
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
30
45
|
document) {
|
|
@@ -35,6 +50,10 @@ export class MLElement extends MLParentNode {
|
|
|
35
50
|
_MLElement_localName.set(this, void 0);
|
|
36
51
|
_MLElement_normalizedAttrs.set(this, new Map());
|
|
37
52
|
_MLElement_normalizedString.set(this, null);
|
|
53
|
+
/**
|
|
54
|
+
* The pretender context if this element is participating in pretender behavior,
|
|
55
|
+
* or null if it is not a pretender or pretended element.
|
|
56
|
+
*/
|
|
38
57
|
this.pretenderContext = null;
|
|
39
58
|
__classPrivateFieldSet(this, _MLElement_attributes, astNode.attributes.map(attr => new MLAttr(attr, this)), "f");
|
|
40
59
|
this.selfClosingSolidus = astNode.selfClosingSolidus ? new MLToken(astNode.selfClosingSolidus) : null;
|
|
@@ -589,6 +608,12 @@ export class MLElement extends MLParentNode {
|
|
|
589
608
|
get assignedSlot() {
|
|
590
609
|
throw new UnexpectedCallError('Not supported "assignedSlot" property');
|
|
591
610
|
}
|
|
611
|
+
/**
|
|
612
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
613
|
+
*
|
|
614
|
+
* @unsupported
|
|
615
|
+
* @implements DOM API: `Element`
|
|
616
|
+
*/
|
|
592
617
|
get attributeStyleMap() {
|
|
593
618
|
throw new UnexpectedCallError('Not supported "attributeStyleMap" property');
|
|
594
619
|
}
|
|
@@ -765,11 +790,17 @@ export class MLElement extends MLParentNode {
|
|
|
765
790
|
throw new UnexpectedCallError('Not supported "enterKeyHint" property');
|
|
766
791
|
}
|
|
767
792
|
/**
|
|
793
|
+
* Returns the fixed (potentially corrected) node name, which may differ from the
|
|
794
|
+
* original node name after lint fixes such as case normalization.
|
|
795
|
+
*
|
|
768
796
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
769
797
|
*/
|
|
770
798
|
get fixedNodeName() {
|
|
771
799
|
return __classPrivateFieldGet(this, _MLElement_fixedNodeName, "f");
|
|
772
800
|
}
|
|
801
|
+
/**
|
|
802
|
+
* Whether this element has any spread attributes (e.g., `{...props}` in JSX).
|
|
803
|
+
*/
|
|
773
804
|
get hasSpreadAttr() {
|
|
774
805
|
return __classPrivateFieldGet(this, _MLElement_attributes, "f").some(attr => attr.localName === '#spread');
|
|
775
806
|
}
|
|
@@ -2000,6 +2031,9 @@ export class MLElement extends MLParentNode {
|
|
|
2000
2031
|
return previousElementSibling(this);
|
|
2001
2032
|
}
|
|
2002
2033
|
/**
|
|
2034
|
+
* Returns the original raw element name exactly as it appears in the AST,
|
|
2035
|
+
* without any case normalization or pretender resolution.
|
|
2036
|
+
*
|
|
2003
2037
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2004
2038
|
*/
|
|
2005
2039
|
get rawName() {
|
|
@@ -2016,6 +2050,9 @@ export class MLElement extends MLParentNode {
|
|
|
2016
2050
|
throw new UnexpectedCallError('Not supported "role" property');
|
|
2017
2051
|
}
|
|
2018
2052
|
/**
|
|
2053
|
+
* Returns the rule configuration for this element, respecting the pretender context.
|
|
2054
|
+
* If the element is a pretended origin, returns the rule from the pretending element.
|
|
2055
|
+
*
|
|
2019
2056
|
* @implements `@markuplint/ml-core` API: `MLNode`
|
|
2020
2057
|
*/
|
|
2021
2058
|
get rule() {
|
|
@@ -2287,6 +2324,12 @@ export class MLElement extends MLParentNode {
|
|
|
2287
2324
|
computedStyleMap() {
|
|
2288
2325
|
throw new UnexpectedCallError('Not supported "computedStyleMap" method');
|
|
2289
2326
|
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Overrides the fixed node name for this element, used when the element's
|
|
2329
|
+
* tag name needs to be corrected during linting (e.g., case normalization).
|
|
2330
|
+
*
|
|
2331
|
+
* @param name - The new node name to set
|
|
2332
|
+
*/
|
|
2290
2333
|
fixNodeName(name) {
|
|
2291
2334
|
__classPrivateFieldSet(this, _MLElement_fixedNodeName, name, "f");
|
|
2292
2335
|
}
|
|
@@ -2303,7 +2346,12 @@ export class MLElement extends MLParentNode {
|
|
|
2303
2346
|
throw new UnexpectedCallError('Not supported "focus" method');
|
|
2304
2347
|
}
|
|
2305
2348
|
/**
|
|
2349
|
+
* Computes the accessible name of this element according to the
|
|
2350
|
+
* Accessible Name and Description Computation algorithm.
|
|
2351
|
+
*
|
|
2306
2352
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2353
|
+
* @param version - The ARIA specification version to use for computation
|
|
2354
|
+
* @returns The computed accessible name string
|
|
2307
2355
|
*/
|
|
2308
2356
|
getAccessibleName(version) {
|
|
2309
2357
|
return getAccname(this, version);
|
|
@@ -2367,7 +2415,12 @@ export class MLElement extends MLParentNode {
|
|
|
2367
2415
|
throw new UnexpectedCallError('Not supported "getAttributeNodeNS" method');
|
|
2368
2416
|
}
|
|
2369
2417
|
/**
|
|
2418
|
+
* Gets the attribute value from the original (non-pretended) attributes list,
|
|
2419
|
+
* bypassing any pretender context that might be active.
|
|
2420
|
+
*
|
|
2370
2421
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2422
|
+
* @param attrName - The attribute name to look up (case-insensitive)
|
|
2423
|
+
* @returns The attribute value, or null if the attribute is not found
|
|
2371
2424
|
*/
|
|
2372
2425
|
getAttributePretended(attrName) {
|
|
2373
2426
|
for (const attr of __classPrivateFieldGet(this, _MLElement_attributes, "f")) {
|
|
@@ -2378,7 +2431,12 @@ export class MLElement extends MLParentNode {
|
|
|
2378
2431
|
return null;
|
|
2379
2432
|
}
|
|
2380
2433
|
/**
|
|
2434
|
+
* Returns all attribute tokens matching the given name, including duplicates.
|
|
2435
|
+
* Unlike `getAttribute`, this returns the full `MLAttr` token objects.
|
|
2436
|
+
*
|
|
2381
2437
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2438
|
+
* @param attrName - The attribute name to look up (case-insensitive)
|
|
2439
|
+
* @returns An array of matching attribute tokens
|
|
2382
2440
|
*/
|
|
2383
2441
|
getAttributeToken(attrName) {
|
|
2384
2442
|
const attrs = [];
|
|
@@ -2391,7 +2449,11 @@ export class MLElement extends MLParentNode {
|
|
|
2391
2449
|
return attrs;
|
|
2392
2450
|
}
|
|
2393
2451
|
/**
|
|
2452
|
+
* Returns all attribute tokens for this element, respecting the pretender context.
|
|
2453
|
+
* If the element is pretending to be another, returns the pretender's attributes.
|
|
2454
|
+
*
|
|
2394
2455
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2456
|
+
* @returns A frozen array of all attribute tokens
|
|
2395
2457
|
*/
|
|
2396
2458
|
getAttributeTokens() {
|
|
2397
2459
|
return Object.freeze(this.pretenderContext?.type === 'pretender' ? __classPrivateFieldGet(this.pretenderContext.as, _MLElement_attributes, "f") : __classPrivateFieldGet(this, _MLElement_attributes, "f"));
|
|
@@ -2406,6 +2468,13 @@ export class MLElement extends MLParentNode {
|
|
|
2406
2468
|
getBoundingClientRect() {
|
|
2407
2469
|
throw new UnexpectedCallError('Not supported "getBoundingClientRect" method');
|
|
2408
2470
|
}
|
|
2471
|
+
/**
|
|
2472
|
+
* Returns child elements and non-whitespace text nodes, skipping omitted elements
|
|
2473
|
+
* by flattening their children into the result. Results are cached for performance.
|
|
2474
|
+
*
|
|
2475
|
+
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2476
|
+
* @returns An array of child elements and non-whitespace text nodes
|
|
2477
|
+
*/
|
|
2409
2478
|
getChildElementsAndTextNodeWithoutWhitespaces() {
|
|
2410
2479
|
if (__classPrivateFieldGet(this, _MLElement_getChildElementsAndTextNodeWithoutWhitespacesCache, "f")) {
|
|
2411
2480
|
return __classPrivateFieldGet(this, _MLElement_getChildElementsAndTextNodeWithoutWhitespacesCache, "f");
|
|
@@ -2481,7 +2550,10 @@ export class MLElement extends MLParentNode {
|
|
|
2481
2550
|
throw new UnexpectedCallError('Does not implement "getHTML" method yet');
|
|
2482
2551
|
}
|
|
2483
2552
|
/**
|
|
2553
|
+
* Returns the source location of the element's tag name (excluding the opening `<` character).
|
|
2554
|
+
*
|
|
2484
2555
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2556
|
+
* @returns An object with `offset`, `line`, and `col` properties indicating where the name starts
|
|
2485
2557
|
*/
|
|
2486
2558
|
getNameLocation() {
|
|
2487
2559
|
return {
|
|
@@ -2515,7 +2587,11 @@ export class MLElement extends MLParentNode {
|
|
|
2515
2587
|
return this.attributes.length > 0;
|
|
2516
2588
|
}
|
|
2517
2589
|
/**
|
|
2590
|
+
* Checks whether this element has any mutable attributes, such as spread
|
|
2591
|
+
* attributes or attributes with dynamic values from template expressions.
|
|
2592
|
+
*
|
|
2518
2593
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2594
|
+
* @returns True if any attribute is dynamic or lacks a name node (spread)
|
|
2519
2595
|
*/
|
|
2520
2596
|
hasMutableAttributes() {
|
|
2521
2597
|
for (const attr of this.attributes) {
|
|
@@ -2529,9 +2605,13 @@ export class MLElement extends MLParentNode {
|
|
|
2529
2605
|
return false;
|
|
2530
2606
|
}
|
|
2531
2607
|
/**
|
|
2532
|
-
*
|
|
2608
|
+
* Checks whether this element has children that are potentially mutable,
|
|
2609
|
+
* such as preprocessor-specific blocks, slot elements, or (optionally) elements
|
|
2610
|
+
* with dynamic attributes.
|
|
2533
2611
|
*
|
|
2534
2612
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2613
|
+
* @param attr - When true, also considers children with mutable attributes as mutable
|
|
2614
|
+
* @returns True if this element has potentially mutable children
|
|
2535
2615
|
*/
|
|
2536
2616
|
hasMutableChildren(attr = false) {
|
|
2537
2617
|
for (const child of this.getPureChildNodes()) {
|
|
@@ -2611,7 +2691,12 @@ export class MLElement extends MLParentNode {
|
|
|
2611
2691
|
throw new UnexpectedCallError('Does not implement "insertAdjacentText" method yet');
|
|
2612
2692
|
}
|
|
2613
2693
|
/**
|
|
2694
|
+
* Checks whether this element is a descendant of any element whose UUID
|
|
2695
|
+
* is in the given list, by walking up the parent element chain.
|
|
2696
|
+
*
|
|
2614
2697
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2698
|
+
* @param uuidList - A list of element UUIDs to check against
|
|
2699
|
+
* @returns True if any ancestor element's UUID is in the list
|
|
2615
2700
|
*/
|
|
2616
2701
|
isDescendantByUUIDList(uuidList) {
|
|
2617
2702
|
let el = this.parentElement;
|
|
@@ -2627,7 +2712,11 @@ export class MLElement extends MLParentNode {
|
|
|
2627
2712
|
return false;
|
|
2628
2713
|
}
|
|
2629
2714
|
/**
|
|
2715
|
+
* Checks whether this element has no meaningful child content
|
|
2716
|
+
* (only whitespace-only text nodes or no children at all).
|
|
2717
|
+
*
|
|
2630
2718
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
2719
|
+
* @returns True if the element has no non-whitespace child content
|
|
2631
2720
|
*/
|
|
2632
2721
|
isEmpty() {
|
|
2633
2722
|
for (const childNode of this.childNodes) {
|
|
@@ -2646,6 +2735,15 @@ export class MLElement extends MLParentNode {
|
|
|
2646
2735
|
scope) {
|
|
2647
2736
|
return this.matchMLSelector(selector, scope).matched;
|
|
2648
2737
|
}
|
|
2738
|
+
/**
|
|
2739
|
+
* Matches this element against a CSS selector or regex selector pattern,
|
|
2740
|
+
* returning detailed match results. When the element is a pretender,
|
|
2741
|
+
* it attempts to match both as the pretender and as the original element.
|
|
2742
|
+
*
|
|
2743
|
+
* @param selector - The CSS selector string or regex selector to match against
|
|
2744
|
+
* @param scope - An optional scope node for scoped selector matching
|
|
2745
|
+
* @returns The detailed match result including captured groups from regex selectors
|
|
2746
|
+
*/
|
|
2649
2747
|
matchMLSelector(selector,
|
|
2650
2748
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
2651
2749
|
scope) {
|
|
@@ -2669,7 +2767,11 @@ export class MLElement extends MLParentNode {
|
|
|
2669
2767
|
return matched;
|
|
2670
2768
|
}
|
|
2671
2769
|
/**
|
|
2672
|
-
*
|
|
2770
|
+
* Initializes the pretender context for this element based on the given pretender
|
|
2771
|
+
* configurations. If a matching pretender is found or the element has an `as` attribute,
|
|
2772
|
+
* sets up the pretender/pretended relationship between elements.
|
|
2773
|
+
*
|
|
2774
|
+
* @param pretenders - Optional array of pretender configurations to match against
|
|
2673
2775
|
*/
|
|
2674
2776
|
pretending(pretenders) {
|
|
2675
2777
|
const pretenderConfig = pretenders?.find(option => this.matches(option.selector));
|
|
@@ -2967,7 +3069,12 @@ export class MLElement extends MLParentNode {
|
|
|
2967
3069
|
throw new UnexpectedCallError('Not supported "showPopover" method');
|
|
2968
3070
|
}
|
|
2969
3071
|
/**
|
|
3072
|
+
* Returns a normalized string representation of this element including its tag name,
|
|
3073
|
+
* attributes, and child content. Whitespace-only text nodes are excluded.
|
|
3074
|
+
* The result is cached for repeated calls.
|
|
3075
|
+
*
|
|
2970
3076
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
3077
|
+
* @returns The normalized HTML string of this element
|
|
2971
3078
|
*/
|
|
2972
3079
|
toNormalizeString() {
|
|
2973
3080
|
if (__classPrivateFieldGet(this, _MLElement_normalizedString, "f")) {
|
|
@@ -2989,7 +3096,13 @@ export class MLElement extends MLParentNode {
|
|
|
2989
3096
|
return normalizedString;
|
|
2990
3097
|
}
|
|
2991
3098
|
/**
|
|
3099
|
+
* Returns a string representation of this element. When `fixed` is true,
|
|
3100
|
+
* returns the element with any lint fixes applied to the tag name,
|
|
3101
|
+
* attributes, and embedded comment nodes.
|
|
3102
|
+
*
|
|
2992
3103
|
* @implements `@markuplint/ml-core` API: `MLElement`
|
|
3104
|
+
* @param fixed - When true, returns the fixed content; otherwise returns the original raw content
|
|
3105
|
+
* @returns The string content of this element
|
|
2993
3106
|
*/
|
|
2994
3107
|
toString(fixed = false) {
|
|
2995
3108
|
if (!fixed) {
|
|
@@ -8,6 +8,15 @@ import type { RuleInfo } from '../../index.js';
|
|
|
8
8
|
import type { MLASTNode } from '@markuplint/ml-ast';
|
|
9
9
|
import type { AnyRule, PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
10
10
|
import { MLToken } from '../token/token.js';
|
|
11
|
+
/**
|
|
12
|
+
* Abstract base class for all markuplint DOM node wrappers.
|
|
13
|
+
* Extends `MLToken` with DOM `Node` interface compliance, tree traversal,
|
|
14
|
+
* rule configuration access, and child node management.
|
|
15
|
+
*
|
|
16
|
+
* @template T - The rule configuration value type
|
|
17
|
+
* @template O - The rule options type
|
|
18
|
+
* @template A - The underlying AST node type
|
|
19
|
+
*/
|
|
11
20
|
export declare abstract class MLNode<T extends RuleConfigValue, O extends PlainData = undefined, A extends MLASTNode = MLASTNode> extends MLToken<A> implements Node {
|
|
12
21
|
#private;
|
|
13
22
|
/**
|
|
@@ -201,6 +210,13 @@ export declare abstract class MLNode<T extends RuleConfigValue, O extends PlainD
|
|
|
201
210
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-node-ownerdocument%E2%91%A0
|
|
202
211
|
*/
|
|
203
212
|
get ownerDocument(): any;
|
|
213
|
+
/**
|
|
214
|
+
* The owning `MLDocument` instance with proper generic types,
|
|
215
|
+
* providing type-safe access to the document without the `any` type
|
|
216
|
+
* used by the DOM-compatible `ownerDocument`.
|
|
217
|
+
*
|
|
218
|
+
* @implements `@markuplint/ml-core` API: `MLNode`
|
|
219
|
+
*/
|
|
204
220
|
get ownerMLDocument(): MLDocument<T, O>;
|
|
205
221
|
/**
|
|
206
222
|
* The parent element.
|
package/lib/ml-dom/node/node.js
CHANGED
|
@@ -16,6 +16,15 @@ import { isChildNode } from './child-node.js';
|
|
|
16
16
|
import { toNodeList } from './node-list.js';
|
|
17
17
|
import { nodeStore } from './node-store.js';
|
|
18
18
|
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
19
|
+
/**
|
|
20
|
+
* Abstract base class for all markuplint DOM node wrappers.
|
|
21
|
+
* Extends `MLToken` with DOM `Node` interface compliance, tree traversal,
|
|
22
|
+
* rule configuration access, and child node management.
|
|
23
|
+
*
|
|
24
|
+
* @template T - The rule configuration value type
|
|
25
|
+
* @template O - The rule options type
|
|
26
|
+
* @template A - The underlying AST node type
|
|
27
|
+
*/
|
|
19
28
|
export class MLNode extends MLToken {
|
|
20
29
|
constructor(astNode,
|
|
21
30
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
@@ -271,6 +280,13 @@ export class MLNode extends MLToken {
|
|
|
271
280
|
get ownerDocument() {
|
|
272
281
|
return __classPrivateFieldGet(this, _MLNode_ownerDocument, "f");
|
|
273
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* The owning `MLDocument` instance with proper generic types,
|
|
285
|
+
* providing type-safe access to the document without the `any` type
|
|
286
|
+
* used by the DOM-compatible `ownerDocument`.
|
|
287
|
+
*
|
|
288
|
+
* @implements `@markuplint/ml-core` API: `MLNode`
|
|
289
|
+
*/
|
|
274
290
|
get ownerMLDocument() {
|
|
275
291
|
return __classPrivateFieldGet(this, _MLNode_ownerDocument, "f");
|
|
276
292
|
}
|
|
@@ -2,6 +2,14 @@ import type { TextNodeType } from './types.js';
|
|
|
2
2
|
import type { MLASTText } from '@markuplint/ml-ast';
|
|
3
3
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import { MLCharacterData } from './character-data.js';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a DOM Text node wrapper in the markuplint DOM tree.
|
|
7
|
+
* Wraps an AST text token and provides text-specific operations such as
|
|
8
|
+
* detecting raw text element content and whitespace-only nodes.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The rule configuration value type
|
|
11
|
+
* @template O - The rule options type
|
|
12
|
+
*/
|
|
5
13
|
export declare class MLText<T extends RuleConfigValue, O extends PlainData = undefined> extends MLCharacterData<T, O, MLASTText> implements Text {
|
|
6
14
|
/**
|
|
7
15
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -33,10 +41,14 @@ export declare class MLText<T extends RuleConfigValue, O extends PlainData = und
|
|
|
33
41
|
*
|
|
34
42
|
* @implements `@markuplint/ml-core` API: `MLText`
|
|
35
43
|
* @see https://html.spec.whatwg.org/multipage/syntax.html#raw-text-elements
|
|
44
|
+
* @returns True if this text node is the content of a raw text element
|
|
36
45
|
*/
|
|
37
46
|
isRawTextElementContent(): boolean;
|
|
38
47
|
/**
|
|
48
|
+
* Checks whether this text node contains only whitespace characters.
|
|
49
|
+
*
|
|
39
50
|
* @implements `@markuplint/ml-core` API: `MLText`
|
|
51
|
+
* @returns True if the raw content is composed entirely of whitespace
|
|
40
52
|
*/
|
|
41
53
|
isWhitespace(): boolean;
|
|
42
54
|
/**
|
package/lib/ml-dom/node/text.js
CHANGED
|
@@ -6,6 +6,14 @@ import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
|
6
6
|
* @see https://html.spec.whatwg.org/multipage/syntax.html#raw-text-elements
|
|
7
7
|
*/
|
|
8
8
|
const rawTextElements = new Set(['script', 'style']);
|
|
9
|
+
/**
|
|
10
|
+
* Represents a DOM Text node wrapper in the markuplint DOM tree.
|
|
11
|
+
* Wraps an AST text token and provides text-specific operations such as
|
|
12
|
+
* detecting raw text element content and whitespace-only nodes.
|
|
13
|
+
*
|
|
14
|
+
* @template T - The rule configuration value type
|
|
15
|
+
* @template O - The rule options type
|
|
16
|
+
*/
|
|
9
17
|
export class MLText extends MLCharacterData {
|
|
10
18
|
/**
|
|
11
19
|
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
@@ -45,12 +53,16 @@ export class MLText extends MLCharacterData {
|
|
|
45
53
|
*
|
|
46
54
|
* @implements `@markuplint/ml-core` API: `MLText`
|
|
47
55
|
* @see https://html.spec.whatwg.org/multipage/syntax.html#raw-text-elements
|
|
56
|
+
* @returns True if this text node is the content of a raw text element
|
|
48
57
|
*/
|
|
49
58
|
isRawTextElementContent() {
|
|
50
59
|
return this.parentElement ? rawTextElements.has(this.parentElement.nodeName.toLowerCase()) : false;
|
|
51
60
|
}
|
|
52
61
|
/**
|
|
62
|
+
* Checks whether this text node contains only whitespace characters.
|
|
63
|
+
*
|
|
53
64
|
* @implements `@markuplint/ml-core` API: `MLText`
|
|
65
|
+
* @returns True if the raw content is composed entirely of whitespace
|
|
54
66
|
*/
|
|
55
67
|
isWhitespace() {
|
|
56
68
|
return /^\s+$/.test(this.raw);
|