File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,26 @@ const nodeTypes = new Map<ElementType, number>([
1111 [ ElementType . Root , 9 ] ,
1212] ) ;
1313
14+ interface SourceCodeLocation {
15+ /** One-based line index of the first character. */
16+ startLine : number ;
17+ /** One-based column index of the first character. */
18+ startCol : number ;
19+ /** Zero-based first character index. */
20+ startOffset : number ;
21+ /** One-based line index of the last character. */
22+ endLine : number ;
23+ /** One-based column index of the last character. Points directly *after* the last character. */
24+ endCol : number ;
25+ /** Zero-based last character index. Points directly *after* the last character. */
26+ endOffset : number ;
27+ }
28+
29+ interface TagSourceCodeLocation extends SourceCodeLocation {
30+ startTag ?: SourceCodeLocation ;
31+ endTag ?: SourceCodeLocation ;
32+ }
33+
1434/**
1535 * This object will be used as the prototype for Nodes when creating a
1636 * DOM-Level-1-compliant structure.
@@ -36,14 +56,7 @@ export class Node {
3656 *
3757 * Available if parsing with parse5 and location info is enabled.
3858 */
39- sourceCodeLocation ?: {
40- startOffset : number ;
41- endOffset : number ;
42- startLine : number ;
43- endLine : number ;
44- startColumn : number ;
45- endColumn : number ;
46- } ;
59+ sourceCodeLocation ?: SourceCodeLocation | null ;
4760
4861 /**
4962 *
@@ -265,6 +278,13 @@ export class Element extends NodeWithChildren {
265278 super ( type , children ) ;
266279 }
267280
281+ /**
282+ * `parse5` source code location info, with start & end tags.
283+ *
284+ * Available if parsing with parse5 and location info is enabled.
285+ */
286+ sourceCodeLocation ?: TagSourceCodeLocation | null ;
287+
268288 // DOM Level 1 aliases
269289
270290 /**
You can’t perform that action at this time.
0 commit comments