Skip to content
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

Allow arbitrary whitespaces in supports queries #815

Merged
merged 1 commit into from Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -893,7 +893,7 @@ var QUERIES = {
},
supports: {
matches: ['supportType', 'feature'],
regexp: /^(?:(fully|partially) )?supports\s+([\w-]+)$/,
regexp: /^(?:(fully|partially)\s+)?supports\s+([\w-]+)$/,
select: function (context, node) {
env.loadFeature(browserslist.cache, node.feature)
var withPartial = node.supportType !== 'fully'
Expand Down
11 changes: 11 additions & 0 deletions test/feature.test.js
Expand Up @@ -72,6 +72,12 @@ test('selects browsers by feature, including partial support', () => {
'chrome 82',
'chrome 81'
])

equal(browserslist('partially supports rtcpeerconnection'), [
'and_chr 81',
'chrome 82',
'chrome 81'
])
})

test('selects browsers by feature, omiting partial support', () => {
Expand All @@ -85,6 +91,11 @@ test('selects browsers by feature, omiting partial support', () => {
'and_chr 81',
'chrome 82'
])

equal(browserslist('fully supports rtcpeerconnection'), [
'and_chr 81',
'chrome 82'
])
})

test('selects browsers by feature with dashes in its name', () => {
Expand Down