Skip to content

Commit 98f2813

Browse files
committed
fix: better comments
1 parent 455bb2e commit 98f2813

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

packages/@lwc/ssr-compiler/src/compile-template/adjacent-text-nodes.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ export function generateConcatenatedTextNodesExpressions(cxt: TransformerContext
7070
textNodes.unshift(sibling);
7171
}
7272
} else {
73-
// if we reach the beginning of the array or a non-Text/Comment node, we are done
73+
// If we reach a non-Text/Comment node, we are done. These should not be concatenated
74+
// with sibling Text nodes separated by e.g. an Element:
75+
// {a}{b}<div></div>{c}{d}
76+
// In the above, {a} and {b} are concatenated, and {c} and {d} are concatenated,
77+
// but the `<div>` separates the two groups.
7478
break;
7579
}
7680
}

packages/@lwc/ssr-compiler/src/compile-template/ir-to-es.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function irChildrenToEs(
7575
const result: EsStatement[] = [];
7676

7777
for (let i = 0; i < children.length; i++) {
78-
// must set the siblings inside the for loop due nested children
78+
// must set the siblings inside the for loop due to nested children
7979
cxt.siblings = children;
8080
cxt.currentNodeIndex = i;
8181
const cleanUp = cb?.(children[i]);

packages/@lwc/ssr-compiler/src/compile-template/transformers/component/slotted-content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function getLightSlottedContent(rootNodes: IrChildNode[], cxt: TransformerContex
157157

158158
const traverse = (nodes: IrChildNode[], ancestorIndices: number[]) => {
159159
for (let i = 0; i < nodes.length; i++) {
160-
// must set the siblings inside the for loop due nested children
160+
// must set the siblings inside the for loop due to nested children
161161
cxt.siblings = nodes;
162162
cxt.currentNodeIndex = i;
163163
const node = nodes[i];

0 commit comments

Comments
 (0)