Skip to content

feat: implement remaining ClassList methods#5233

Merged
divmain merged 4 commits intomasterfrom
divmain/classlist-methods
Feb 25, 2025
Merged

feat: implement remaining ClassList methods#5233
divmain merged 4 commits intomasterfrom
divmain/classlist-methods

Conversation

@divmain
Copy link
Contributor

@divmain divmain commented Feb 25, 2025

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?

  • 😮‍💨 No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • 🔬 Yes, it does include an observable change.

Feature addition.

GUS work item

W-17894489

@divmain divmain requested a review from a team as a code owner February 25, 2025 19:59
@@ -0,0 +1 @@
classList.forEach is not a function No newline at end of file
Copy link
Contributor Author

@divmain divmain Feb 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@jye-sf jye-sf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just sanity check:

  • .trim() is an intentional net-new addition to the previous classname parsing logic of split+filter.

Otherwise looks fine to me!

@divmain divmain merged commit 76cfad1 into master Feb 25, 2025
11 checks passed
@divmain divmain deleted the divmain/classlist-methods branch February 25, 2025 22:33
function parseClassName(className: string | null): string[] {
return (className ?? '')
.split(MULTI_SPACE)
.map((item) => item.trim())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.map((item) => item.trim())

I don't think it's possible to split on /\s+/ and have anything left to trim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants