-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
v3: Allow hyphen character in regex pattern to use support queries as is #13605
v3: Allow hyphen character in regex pattern to use support queries as is #13605
Conversation
let check = normalize(value) | ||
let isRaw = /^\w*\s*\(/.test(check) | ||
let check = value.startsWith('--') ? value : normalize(value) | ||
let isRaw = /^[\w-]*\s*\(/.test(check) |
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.
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]:flex
with 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
supports
queries
@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
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.
Thanks for the PR! 💪
@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 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]:grid
supports-[transform-origin:5%_5%]:underline
supports-[not(foo:bar)]:underline
supports-[(foo:bar)or(bar:baz)]:underline
supports-[(foo:bar)and(bar:baz)]:underline
supports-[(foo:bar)_and_(bar:baz)]:grid
supports-[(foo:bar)_and_(bar:baz)_or(baz:qux)]:grid
supports-[container-type]:underline
supports-grid:underline
supports-[--test]:flex
supports-[selector(A_>_B)]:underline
supports-[font-format(opentype)]:grid
supports-[font-tech(color-COLRv1)]:flex