feat: implement remaining ClassList methods#5233
Merged
Conversation
divmain
commented
Feb 25, 2025
| @@ -0,0 +1 @@ | |||
| classList.forEach is not a function No newline at end of file | |||
Contributor
Author
There was a problem hiding this comment.
This PR introduces functionality that is not present in SSRv1. It is unclear to me how the (internal) components that are failing with SSRv2 ever rendered with SSRv1, unless the codepath just wasn't hit for some reason.
jye-sf
approved these changes
Feb 25, 2025
Contributor
jye-sf
left a comment
There was a problem hiding this comment.
Just sanity check:
- .trim() is an intentional net-new addition to the previous classname parsing logic of split+filter.
Otherwise looks fine to me!
wjhsf
reviewed
Feb 26, 2025
| function parseClassName(className: string | null): string[] { | ||
| return (className ?? '') | ||
| .split(MULTI_SPACE) | ||
| .map((item) => item.trim()) |
Contributor
There was a problem hiding this comment.
Suggested change
| .map((item) => item.trim()) |
I don't think it's possible to split on /\s+/ and have anything left to trim.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Details
We believed that these ClassList methods would not be needed in the new SSR implementation. However, it appears that there are some use cases that are unavoidable.
The overall implementation for ClassList was made more DRY with the introduction of
parseClassName.Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
Feature addition.
GUS work item
W-17894489