-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ssr): fix adjacent text node concatenation within slotted content #5069
Closed
nolanlawson
wants to merge
6
commits into
master
from
mob/concatenate-adjacent-text-nodes-party-again-yay
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c5eb6f1
wip
wjhsf f9674e4
fix: merge text nodes in ir-to-es
jhefferman-sfdc 4ab455b
fix: eslint
jhefferman-sfdc 36c2e11
fix: bring back text.ts temporarily
nolanlawson 8c8e469
Merge remote-tracking branch 'origin/master' into mob/concatenate-adj…
nolanlawson 2a5684e
fix: start on routine
nolanlawson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
26 changes: 26 additions & 0 deletions
26
...__/fixtures/slot-not-at-top-level/with-adjacent-text-nodes/if/light/expected-correct.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<x-outer> | ||
<div> | ||
Outer! | ||
</div> | ||
<x-inner> | ||
<div> | ||
Inner! | ||
</div> | ||
<!----> | ||
| ||
<x-deep> | ||
<div> | ||
Deep! | ||
</div> | ||
<!----> | ||
| ||
<div> | ||
| ||
</div> | ||
| ||
<!----> | ||
</x-deep> | ||
| ||
<!----> | ||
</x-inner> | ||
</x-outer> |
26 changes: 26 additions & 0 deletions
26
.../fixtures/slot-not-at-top-level/with-adjacent-text-nodes/if/light/expected-incorrect.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<x-outer> | ||
<div> | ||
Outer! | ||
</div> | ||
<x-inner> | ||
<div> | ||
Inner! | ||
</div> | ||
<!----> | ||
| ||
<x-deep> | ||
<div> | ||
Deep! | ||
</div> | ||
<!----> | ||
| ||
<div> | ||
| ||
</div> | ||
| ||
<!----> | ||
</x-deep> | ||
| ||
<!----> | ||
</x-inner> | ||
</x-outer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
packages/@lwc/template-compiler/src/shared/get-text-node-metadata.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: MIT | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
*/ | ||
import type { BaseParentNode, Text } from './types'; | ||
|
||
export function getPreviousAdjacentSiblings(node: Text, parent: BaseParentNode, preserveComments: boolean) { | ||
const siblings = [] | ||
for (let i = 0; i < parent.children.length; i++) { | ||
const otherChild = parent.children[i] | ||
if (otherChild === node) { | ||
return siblings | ||
} else if (node.type === 'Text' || (node.type === 'Comment' && !preserveComments)) { | ||
siblings.push(node) | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we renamed this to
normalizeTextContent
. I guess not. 🤔