fix: css syntax error: 'Unclosed string'#1735
Open
KuznetsovRoman wants to merge 1 commit intorrweb-io:masterfrom
Open
fix: css syntax error: 'Unclosed string'#1735KuznetsovRoman wants to merge 1 commit intorrweb-io:masterfrom
KuznetsovRoman wants to merge 1 commit intorrweb-io:masterfrom
Conversation
🦋 Changeset detectedLatest commit: 9a9db7c The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
d0328dc to
5408907
Compare
KuznetsovRoman
commented
Sep 8, 2025
|
|
||
| if (quickTestRegExp.test(cssStringified)) { | ||
| // Remove e.g. "border-top-style: ;" | ||
| const regex = /(?<=^|\{|\;)\s*[_a-zA-Z][_a-zA-Z0-9-]*:\s*;/gm; |
Author
There was a problem hiding this comment.
regex breakdown:
- We should see "new line" or "{" or ";" before regex starts (which is precedes css rule name)
(?<=^|\{|\;) - Regex might start with empty symbols (between "new line / { / ;" and actual css rule name)
\s* - Then it matches css rule name
[_a-zA-Z][_a-zA-Z0-9-]* - After css rule name, there should be ":" symbol (between css rule name and its value)
: - Then it might have some empty symbols
\s* - Then its essential to end css rule, without any characters, which might be interpreted as css value
;
All occurrences of that regex are invalid css properties and have to be removed
Comment on lines
+175
to
+177
| const quickTestRegExp = /:\s*;/; | ||
|
|
||
| if (quickTestRegExp.test(cssStringified)) { |
Author
There was a problem hiding this comment.
The bug is rare, so it worth to check "if original css rules even has pattern of :\s*;"
If it hasn't, then we don't need to execute regex.
This will save some CPU cycles
5408907 to
9a9db7c
Compare
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.
Fixes #1734