v3: Allow hyphen character in regex pattern to use support queries as is#13605
Merged
RobinMalfait merged 2 commits intotailwindlabs:v3from Jan 28, 2025
Merged
v3: Allow hyphen character in regex pattern to use support queries as is#13605RobinMalfait merged 2 commits intotailwindlabs:v3from
RobinMalfait merged 2 commits intotailwindlabs:v3from
Conversation
Comment on lines
-412
to
+413
| let check = normalize(value) | ||
| let isRaw = /^\w*\s*\(/.test(check) | ||
| let check = value.startsWith('--') ? value : normalize(value) | ||
| let isRaw = /^[\w-]*\s*\(/.test(check) |
Contributor
Author
There was a problem hiding this comment.
2 changes made
-
added a
value.startsWith('--')pre-normalization check that operates in line with Remove automaticvar(…)injection #13537 to prevent automaticvar(…)injection when checking support for custom propertiesexample:
supports-[--test]:flexwith vs. without with thevalue.startsWith('--')to prevent normalizing:- ❌
@supports var(--test)(before, without check) - ✅
@supports (--test: var(--tw))(after, with check)
- ❌
-
added hyphen-support for regex pattern matching raw
supportsqueries
Contributor
Author
|
@adamwathan @RobinMalfait Just a reminder that this PR is ready to merge (after syncing). Its v4 equivalent was merged via #13596. This PR resolves issue #13594 (comment). |
201c7a8 to
a01b9bd
Compare
Contributor
Author
|
@RobinMalfait Sure thing. I saw Adam mentioned (here) that he was still seeing the issue in his testing. Were you able to verify my fix on your end? |
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.
This is the v3 equivalent of PR #13596
Matching for the hyphen character in the existing regex to use support queries as-is
Resolves #13594
Tests (w/ updated):
supports-[display:grid]:gridsupports-[transform-origin:5%_5%]:underlinesupports-[not(foo:bar)]:underlinesupports-[(foo:bar)or(bar:baz)]:underlinesupports-[(foo:bar)and(bar:baz)]:underlinesupports-[(foo:bar)_and_(bar:baz)]:gridsupports-[(foo:bar)_and_(bar:baz)_or(baz:qux)]:gridsupports-[container-type]:underlinesupports-grid:underlinesupports-[--test]:flexsupports-[selector(A_>_B)]:underlinesupports-[font-format(opentype)]:gridsupports-[font-tech(color-COLRv1)]:flex